#include <iostream>
using namespace std;
class A
{
public:
A() {cout << "Call A constructor!" << endl;}
};
class B : public A
{
public:
B() {cout << "Call B constructor!" << endl;}
};
class C : public B
{
public:
C() {cout << "Call C constructor!" << endl;}
};
class X : public C
{
public:
X() {cout << "Call X constructor!" << endl;}
};
class Y
{
public:
Y() {cout << "Call Y constructor!" << endl;}
};
class Z : public Y
{
public:
Z() {cout << "Call Z constructor!" << endl;}
};
class MI : public X, public Z
{
};
main()
{
MI m;
}
OUTPUT:
Call A constructor!
Call B constructor!
Call C constructor!
Call X constructor!
Call Y constructor!
Call Z constructor!
using namespace std;
class A
{
public:
A() {cout << "Call A constructor!" << endl;}
};
class B : public A
{
public:
B() {cout << "Call B constructor!" << endl;}
};
class C : public B
{
public:
C() {cout << "Call C constructor!" << endl;}
};
class X : public C
{
public:
X() {cout << "Call X constructor!" << endl;}
};
class Y
{
public:
Y() {cout << "Call Y constructor!" << endl;}
};
class Z : public Y
{
public:
Z() {cout << "Call Z constructor!" << endl;}
};
class MI : public X, public Z
{
};
main()
{
MI m;
}
OUTPUT:
Call A constructor!
Call B constructor!
Call C constructor!
Call X constructor!
Call Y constructor!
Call Z constructor!