填空题

在声明派生类时,如果不显式地给出继承方式,那么默认的类继承方式是私有继承prirate。已知有如下类定义:
class Base
protected:
void fun( )
;
Class Derived:Base;
则Base类中的成员函数fun( )在Derived类中的访问权限是______(注意:要求填写private、protected或public中的一项)。

【参考答案】

private
<上一题 目录 下一题>
热门 试题

填空题
如果不能使用多态机制,那么通过基类的指针虽然可以指向派生类对象,但是只能访问从基数继承的成员,下列程序没有使用多态机制,其输出结果是______。 #include<iostream> using namespaee std; class Base public: void print( )tout<<’B’; class Derived:publie Base public: void print( )tout<<’D’; int main( ) Derived*pd=new Derived( ); Base*pb=pd: pb->print( ); pd->print( ); delete pd; return 0;
填空题
若下面程序运行时输出结果为 1,A,10.1 2,B,3.5 请将程序补充完整。 #include<iostream> using namespace std; int main( ) void test(int,char,double______); test(1,’A’,10.1); test(2,’B’); return 0; void test(int a,char b,doubleC) cout<<a<<’,’<<b<<’,’<<c<<endl;
相关试题
  • 下列程序的输出结果是______。 #in...
  • 插入排序算法的主要思想是:每次从未排序序...
  • 在MyClass类的定义中,对赋值运算符“=”...
  • 有如下程序: #include <iostream> u...