构造: 现有父类后有子类
析构:和构造顺序相反,先析构子类后析构父类
#include <iostream> class A { public: A() { std::cout << "ctor father" << std::endl; } virtual ~A() { std::cout << "dtor fathor" << std::endl; } }; class a : public A { public: a() { std::cout << "ctor son" << std::endl; } ~a() { std::cout << "dtor son" << std::endl; } }; int main(void) { a aa; return 0; }
标签:顺序,继承,子类,构造,析构,父类 From: https://www.cnblogs.com/wangtianning1223/p/17055528.html