#include <iostream>
using std::cout;
using std::endl;

class Person {
public:
Person() {
cout << "Person" << endl;
}
virtual ~Person() {
cout << "~Person" << endl;
}
};
class A : public Person{
public:
A() {
cout << "A" << endl;
}
virtual ~A() {
cout << "~A" << endl;
}
void show() {
cout << "AAA" << endl;
}
};
int main() {
A* a = new A();
a->show();
delete a;
return 0; //
}
Person
A
AAA
~A
~Person

所以顺序是基类构造—派生类构造—派生类析构—基类析构