Defaulted and Deleted Methods
C++11 provides more control over which methods are used. Suppose that you wish to use a defaulted function that, due to circumstances, isn’t created automatically. For example, if you provide a move constructor, then the default constructor, the copy constructor, and the copy assignment operator are not provided. In that case, you can use the keyword default to explicitly declare the defaulted versions of these methods:
class Someclass{public: Someclass(Someclass &&); Someclass() = default; // use compiler-generated default constructor Someclass(const Someclass &) = default; Someclass & operator=(const Someclass &) = default;...};
The compiler provides the same constructor that it would have provided ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access