In some circumstances, C ++ implementations implicitly define the default constructor (12.1), copy constructor (12.8), move constructor (12.8), copy assignment operator (12.8), move assignment operator (12.8), or destructor (12.4) member functions.
--- N3690_CPP-11_Draft, Page-No: 33class C { };By default contains the implicit defined functions:
class C { public: C(){ } //default constructor C(const C&) //copy constructor { } C& operator=(const C& x) //copy assignment operator { return *this; } ~C(){ } //destructor };In case if any constructor is explicitly defined inside the class, compiler will override the default constructor. But other implicit constructor will still be there until it is not explicitly overridden by the programmer. Example:
class C { public: C(C& obj){ } };contains the implicit defined functions:
class C { public: /*C(){ }*/ //no default constructor C(C& obj){ } //explicitly defined by programmer C(const C&) //copy constructor { } C& operator=(const C& x) //copy assignment operator { return *this; } ~C(){ } //destructor };
No comments :
Post a Comment