|
|
class Grandpa { public: Grandpa() { cout << "G"; } ~Grandpa() { cout << "~G"; } };
class Father : public Grandpa { public: Father() { cout << "F"; } ~Father() { cout << "~F"; } };
class Mother { public: Mother() { cout << "M"; } ~Mother() { cout << "~M"; } };
class Child : public Father, public Mother { public: Child() { cout << "C"; } ~Child() { cout << "~C"; } };
构造顺序:Grandpa, Father, Mother, Child
析构顺序:相反
|
|