首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类定义: 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-07-22
17
问题
有如下类定义:
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/4ANp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
【】是在进行了成功的测试之后才开始的。它与软件测试不同,测试的目的是发现错误,进一步诊断和改正错误,则是调试的任务。
带有虚基类的多层次派生类构造函数的成员初始化列表中都要列出虚基类的构造函数,这样对虚基类的子对象初始化
一个项目具有一个项目主管,一个项目主管可管理多个项目。则实体集“项目主管”与实体集“项目”的联系属于【】的联系。
如果表达式y*x+十中,“*”是作为成员函数重载的运算符,“++”是作为友元函数重载的运算符,采用运算符函数调用格式,该表达式还可表示为
下列类的定义中,有()处语法错误。classBase{public:Base(){}Base(inti){data=i;}
设在主函数中有以下定义和函数调用语句,且fun()函数为void类型,请写出fun()函数的首部【】。intmain(){doubles[10][22];intn;fun(s);re
关于在调用模板函数时模板实参的使用,下列表述正确的是
以下对模板的说明,正确的是()。
类模板的模板参数()。
随机试题
某部门举行年会抽奖活动。抽奖箱里有80个抽奖券,共20个不同的数字,每个数字均出现4次,且分别对应一份礼品,不同的数字对应的礼品不同。每人当天限抽1次。那么最少多少人当天参加抽奖活动,才能保证至少有3人领取的礼品相同?
面积注水的油田最显著的特点是采油井()处在注水受效的第一线上。
GH分泌过多的患者可出现
下列哪项被确定为我国卫生立法的重要原则和卫生工作的根本方针
下列关于人民币的法定管理部门的叙述中,有误的一项是()。
维吾尔族从产生之时就信仰伊斯兰教,回族是后来才皈依伊斯兰教的。()
下列选项中,具有曲线美的构图方式是()。
2011年上半年,天津市新批三资企业328家,比上年同期下降3.8%;合同外资额90.35亿美元,增长10.0%;实际使用外资72.34亿美元,增长22.3%。其中,新批合同外资1000万美元以上项目89个;合同外资79.4亿美元,增长7.2%,占全市合同
窗体上有一个名称为Command1的命令按钮,其单击事件过程如下:OptionBase1PrivateSubCommand1_Click()Dima(4,4)AsIntegerFori=1To4
_________hecomelate,givehimthemessage.
最新回复
(
0
)