August 2012
Intermediate to advanced
976 pages
30h 17m
English
= defaultWe can explicitly ask the compiler to generate the synthesized versions of the copy-control members by defining them as = default (§ 7.1.4, p. 264):
class Sales_data {public: // copy control; use defaults Sales_data() = default; Sales_data(const Sales_data&) = default; Sales_data& operator=(const Sales_data &); ~Sales_data() = default; // other members as before};Sales_data& Sales_data::operator=(const Sales_data&) = default;
When we specify = default on the declaration of the member inside the class body, the synthesized function is implicitly inline (just as is any other member function defined in the ...
Read now
Unlock full access