What is the order of calling for the constructors and destructors in case of objects of inherited classes?

The constructors are called with base class first order and the destructors are called in the child first order. That is, the if we have 2 levels of inheritance A (base)-> B (inherit 1)-> C (inherit 2) then the constructor A is called first followed by B and C. The C destructor is called first followed by B and A.

Be the first to comment

Leave a Reply

Your email address will not be published.


*