Constructing and Destructing sequence for three level inheritance
#include <iostream> using namespace std; class BaseClass { public: BaseClass() { cout << "Constructing base\n"; } ~BaseClass() { cout << "Destructing base\n"; } }; class DerivedClass1 : public BaseClass { public: DerivedClass1() { cout << "Constructing DerivedClass1\n"; } ~DerivedClass1() { cout << "Destructing DerivedClass1\n"; } }; class DerivedClass2: public DerivedClass1 { public: DerivedClass2() { cout << "Constructing DerivedClass2\n"; } ~DerivedClass2() { cout << "Destructing DerivedClass2\n"; } }; int main() { DerivedClass2 ob; return 0; }