#include using namespace std; class father { public: father ( int height ); //父类构造函数带有一个参数height virtual ~father() {cout<<"析构父亲...\n";} virtual void smart() const {cout<<"父亲很聪明"<beautiful(); //用该指针访问从母类继承来的虚函数 ps->smart(); //用该指针访问从父类继承来的虚函数 cout<<"\n小儿子有"<getheight(); //用该指针访问从父类继承来的虚函数 cout<<"英尺高\n"; if ( ps->getsex() ) //用该指针访问从母类继承来的布尔函数 cout<<"性别:男"; else cout<<"性别:女"; cout<<"\n在家排行:第"<getnum() <