#include <iostream> using namespace std; class Father { public: void room(); }; void Father::room() { cout<<"父亲的大房子,我可以享受。"<<endl; } class Son:private Father { public: void enjoy();//父类成员中的room到了子类中变成私有,所以在子类中要用一个公有函数调用 }; void Son::enjoy() { room(); } void main() { Son Mike; Mike.enjoy(); }