Example
The following example depicts two classes: Explicit for which all C++98 special member functions are explicitly declared and Implicit for which none are declared.
#includeIn this case the class Implicit has not explicitly defined the destructor and the compiler will create a destructor equivalently to this:
// Sub-objects are destroyed in the opposite order to their construction Implicit::~Implicit { member.~Explicit; // destroy member (void)p; // do nothing for p, void* has no destructor (void)i; // do nothing for i, int has no destructor ~Explicit; // call the base class's destructor }Read more about this topic: Special Member Functions
Famous quotes containing the word example:
“Our intellect is not the most subtle, the most powerful, the most appropriate, instrument for revealing the truth. It is life that, little by little, example by example, permits us to see that what is most important to our heart, or to our mind, is learned not by reasoning but through other agencies. Then it is that the intellect, observing their superiority, abdicates its control to them upon reasoned grounds and agrees to become their collaborator and lackey.”
—Marcel Proust (18711922)