class Father
{
public:
Father()
{
qDebug()<<"Father gouzao";
}
~Father()
{
qDebug()<<"Father xigou.";
}
};
class Son:Father
{
public:
Son()
{
qDebug()<<"Son gouzao";
}
~Son()
{
qDebug()<<"Son xigou.";
}
};
int main()
{
Son xiaoming;
return 0;
}

可以看到,先是构造父类,然后是子类,析构是先析构子类,再是父类。