| 1. |
What Is The Order Of Calling For The Constructors And Destructors In Case Of Objects Of Inherited Classes? |
|
Answer» 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. 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. |
|