问题

有如下程序:

#include +

using namespace std ;

#include

using namespace std;

class Base

{

public:

void fun(){cout$amp;};

class Derived:public Base

{

public:

void fun()

{

cout$amp;}

};

int main()

{

Derived d;

d.fun();

return 0;

}

已知其执行后的输出结果为:

Base::fun

Derived::fun

则程序中下划线处应填入的语句是

A . Base.fun();

B . Base::fun()

C . Base->fun()

D . fun();

参考答案
您可能感兴趣的试题
  • 下面是重载为非成员函数的运算符函数原型,其中错误的是A . Fraction operator + (Fraction, Fraction);B . Fraction operator - (Frac
  • 有如下函数模板:templateT cast(U u){return u;}其功能是将 U 类型数据转换为 T 类型数据。已知 i 为 int 型变量,下列对模板函数 cast 的调用中正确的是A .
  • 若磁盘上已存在某个文本文件,其全路径文件名为 d:\ncre\test.txt ,下列语句中不 能打开该文件的是A . ifstream file(d:\ncre\test.txt) ;B . i
  • 有如下类定义:class Foo{public:Foo(int v):value(v){} // ①~Foo(){} // ②private:Foo(){} // ③int value = 0; //
  • 有如下类定义:class Point{int x_, y_;public:Point():x_(0), y_(0){}Point(int x, int y = 0):x_(x),y_(y){}};若执
  • 有如下类定义:class Test{public:Test(){ a = 0; c = 0;} // ①int f(int a)const{this->a = a;} // ②static int g
相关内容