问题
单项选择题
有如下程序:
#include <iostream>
using namespace std;
class Base
public:
void fun()( cout<<"Base::fun"<<endl;
;
class Derived: public Base
public:
void fun()
______
cout<<"Derived::fun"<<endl;
;
int main()
Derived d;
D.fun();
return 0;
已知其执行后的输出结果为:
Base::fun
Derived::fun
则程序中下划线处应填入的语句是( )。
A.Base.fun();
B.Base::fun();
C.Base->fun();
D.fun();
答案
参考答案:B