- #include "iostream.h"
- class first
- {
- public:
- first(void)
- {
- cout << "*******************************" << endl;
- cout << "first 构造" << endl;
- cout << "*******************************" << endl;
- cout << endl;
- cout << endl;
- }
- ~first(void)
- {
- cout << "*******************************" << endl;
- cout << "first 析构 " <<endl;
- cout << "*******************************" << endl;
- cout << endl;
- cout << endl;
- }
- };
- class second :public first
- {
- public:
- second(void)
- {
- cout << "*******************************" << endl;
- cout << "second 构造" << endl;
- cout << "*******************************" << endl;
- cout << endl;
- cout << endl;
- }
- ~second(void)
- {
- cout << "*******************************" << endl;
- cout << "second 析构 " <<endl;
- cout << "*******************************" << endl;
- cout << endl;
- cout << endl;
- }
- };
- class three: public second
- {
- public:
- three(void)
- {
- cout << "*******************************" << endl;
- cout << "theree 构造" << endl;
- cout << "*******************************" << endl;
- cout << endl;
- cout << endl;
- }
- ~three(void)
- {
- cout << "*******************************" << endl;
- cout << "three 析构 " <<endl;
- cout << "*******************************" << endl;
- cout << endl;
- cout << endl;
- }
- };
- void main()
- {
- first i;
- second j;
- three k;
- }
///
*******************************
first 构造
*******************************
*******************************
first 构造
*******************************
*******************************
second 构造
*******************************
*******************************
first 构造
*******************************
*******************************
second 构造
*******************************
*******************************
theree 构造
*******************************
*******************************
three 析构
*******************************
*******************************
second 析构
*******************************
*******************************
first 析构
*******************************
*******************************
second 析构
*******************************
*******************************
first 析构
*******************************
*******************************
first 析构
*******************************
Press any key to continue