首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类定义: class AA { int a; public: AA(int n=0):a(n) {} }; class BB :public AA { public: BB(int n) }; 其中横线处缺失的部分
有如下类定义: class AA { int a; public: AA(int n=0):a(n) {} }; class BB :public AA { public: BB(int n) }; 其中横线处缺失的部分
admin
2015-06-27
15
问题
有如下类定义:
class AA {
int a;
public:
AA(int n=0):a(n) {}
};
class BB :public AA {
public:
BB(int n)
};
其中横线处缺失的部分是( )。
选项
A、:a(n){}
B、:AA(n){}
C、{a(n);}
D、{a=n;}
答案
B
解析
本题考查公用继承对基类成员的访问属性。公用继承中,基类的公用成员和保护成员在派生类中保持原有访问属性,其私有成员仍为基类私有,本题中若要给派生类继承下来基类的私有成员赋值,那么只能调用基类的成员函数来对它赋值,所以本题答案为B。
转载请注明原文地址:https://kaotiyun.com/show/ZDNp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
在长度为n的顺序表的第i(1≤i≤n+1)个位置上插入一个元素,元素的移动次数为______。
在表达式x-y中,“-”是作为非成员函数重载的运算符。若使用显式的函数调用代替直接使用运算符“-”,这个表达式还可表示为______。
数据库设计的根本目标是要解决______。
下列有关指针的用法中错误的是()。
派生类的构造函数的成员初始化列表中,不能包含()。
下列选项中不属于软件生命周期定义时期任务的是()。
在结构化方法中,用数据流程图(DFD)作为描述工具的软件开发阶段是()。
长度为n的简单插入排序法,最坏情况需要______次比较。
数据管理技术发展过程经过人工管理、文件系统和数据库系统三个阶段,其中数据独立性最高的阶段是【 】。
在数据管理技术的发展过程中,经历了人工管理阶段、文件系统阶段和数据库系统阶段。其中数据独立性最高的阶段是
随机试题
消化道平滑肌对下列哪项刺激不敏感?
下列关于临界胶束浓度的叙述中正确的是()
"亢则害,承乃制"说明了五行之间的
上颌第二、第三磨牙的牙体长轴
属于化学药与中成药配伍禁忌的是
关于法院可以在诉讼中主动依职权采取的措施中,下列说法正确的是:()
法律格言说:“不知自己之权利,即不知法律。”关于这句法律格言涵义的阐释,下列哪一选项是正确的?(2010年卷一6题)
下列有关具体审计目标的说法中,正确的有()。
“走出去”战略是我国发展的根本基点。()
The"formallearning"referstoalllearningwhichtakesplaceintheclassroomregardlessofwhethersuchlearningis______byc
最新回复
(
0
)