问题
填空题
请将下列类定义补充完整。 class Base{public:void fun(){tout<<"Base::fun"<<endl;}}; class Derived:public Base { public: void fun() { ______//显示调用基类的fun函数 cout<<"Derived::fun"<<endl; };
答案
参考答案:Base::fun();。
解析: 本题考查的是成员函数的调用。 因为横线处的作用是调用基类的fun函数,又因为派生类也碉tun()函数,所以必须对fun()函数加以限定,即Base::fun();。