Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Does a derived class dtor need to explicitly call the base destructor?

0
Posted

Does a derived class dtor need to explicitly call the base destructor?

0

No, never explicitly call a destructor (where “never” means “rarely”). A derived class’s destructor (whether or not you explicitly define one) AUTOMATICALLY invokes the destructors for member objects and base class subobjects. Member objects are destroyed in the reverse order they appear within the class, then base class subobjects are destroyed in the reverse order that they appear in the class’s list of base classes.

Related Questions

Thanksgiving questions

*Sadly, we had to bring back ads too. Hopefully more targeted.