首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: class Base{ public: int data; ); class Derivedl:public Base{}; class Deriv ed2:protected Base{};
有如下程序: class Base{ public: int data; ); class Derivedl:public Base{}; class Deriv ed2:protected Base{};
admin
2019-06-12
55
问题
有如下程序:
class Base{
public:
int data;
);
class Derivedl:public Base{};
class Deriv ed2:protected Base{};
int main(){
Derivedl dl;
Derived2 d2;
d1.data=0: ∥①
d2.data=0: ∥②
return 0:
)
下列关于程序编译结果的描述中,正确的是( )。
选项
A、①②皆无编译错误
B、①有编泽错误,②无编译错误
C、①无编译错误,②有编译错误
D、①②皆有编译错误
答案
C
解析
保护继承的类DerlVied2不能访问基类Base中的公共数据成员data。
转载请注明原文地址:https://www.kaotiyun.com/show/fU8p777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有以下程序:#includeusingnamespacestd;classMyClass{public:staticints;MyClass();voidSetVa
以下程序的执行结果为()。#includeclassSample{intn;public:Sample(inti){n=i;}operator++(){n
下面程序的运行结果是()。#includeintx=5;intfun(inta){intc;C=X*a:returnc;}void
阅读下面程序:#includefun(inta,intb){intc;c=a+b:returnc;}voidmain(){intx=
下列程序输出的结果是()。#includefun1(chara,charb){charc;c=a;a=b;b=c;}fim2(char*a,charb){char.c;c=*a;*a=b;b=
有如下程序:#includeusingnamespacestd;intmain(){int*p;*p=9;cout
随机试题
根据行政处罚法规定,违法行为在()年内未被发现的,不再给予行政处罚。法律另有规定的除外。
根据()可区别地层水和注入水。
变压器室夏季的排风温度不宜高于多少度?进风和排风温差不宜大于多少度?哪组答案是正确的?(2004,103)
甲公司和乙公司均为增值税—般纳税人,适用的增值税税率均为17%。甲公司以在建的工程和生产用A设备与乙公司的生产用B设备、专利权进行交换,假定该交换不具有商业实质,A设备和B设备均为2009年初购买的。资产情况如下。(1)甲公司换出:①在建的工程:已发生的
创造性游戏
创出“五禽戏”并最早使用麻沸散的人是( )。
成语“钩心斗角”现比喻用尽心机,明争暗斗,本意指宫廷建筑结构的交错和精巧。以下成语中,寓意和本意同样发生根本性变化的一项是()。
设某商品的收益函数为R(p),收益弹性为1+p3,其中p为价格,且R(1)=1,则R(p)=________.
"Down-to-earth"meanssomeoneorsomethingthatishonest,realisticandeasytodealwith.Itisapleasuretofind【C1】______wh
Inafamilywheretherolesofmenandwomenarenotsharply【C1】______andwheremanyhouseholdtasksaresharedtoagreateror
最新回复
(
0
)