Consider following code and state the order of execution constructors and order
of execution of destructors.
class C: public A, virtual public B
{ public:
C( ):A( ),B( )
{
cout<<”c class constructor”;
}
};
First will be executed constructor of the B class, then the constructor of the A class, then the constructor of the C class.
The order of the execution of the destructors will be the reversal: first will be executed the destructor of the C class, then the destructor of the A class and, finally, the destructor of the B class.
Comments
Leave a comment