-父类的构造函数->子类调用的构造函数->->子类的构造函数->子类的析构->父类的析构->父类的析构
#include
using namespace std;
class Base1
{
public:
Base1()
{
cout << "Base构造函数~" << endl;
}
~Base1()
{
cout << "Base析构函数~" << endl;
}
};
class Son1 :public Base1
{
public:
Son1()
{
cout << "子类构造函数" << endl;
}
~Son1()
{
cout << "子类析构函数" << endl;
}
};
void test01()
{
Base1 b1;
Son1 s1;
}
int main()
{
test01();
return 0;
}