首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类定义: class AA{ int a; Publie: AA(int n=0):a(n){} }; class BB:public AA{ public: BB(int n)_________
有如下类定义: class AA{ int a; Publie: AA(int n=0):a(n){} }; class BB:public AA{ public: BB(int n)_________
admin
2020-07-30
30
问题
有如下类定义:
class AA{
int a;
Publie:
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
解析
根据派生类构造函数的一般格式:<派生类名>(<总参数表>):<基类名1>(<参数表1>),…<基类名n>(<参数表n>),<成员对象名1>(<参数表n+1>),…<成员对象名m>(<参数表n+m>)<派生类构造函数体>。在派生类BB的构造函数总参数表后面应该接上基类名AA和其参数。
转载请注明原文地址:https://kaotiyun.com/show/3Typ777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有如下类定义:classPoint{public:voidSetX(intxx);voidSetY(intyy);private:
有如下类定义:classPass{staticintcount;public:Pass(){}voidshow()const;friendin
有如下类定义:classMyClass{public:MyClass(doubled=0.0):val(d){}______________/
下列运算符中,可以重载为类的友元函数的运算符是
下列叙述中正确的是
有如下类声明:classPam{intk;public:Pam(intn):k(n){}voidshow()const;};若要在类体外给出成员函数s
有如下程序:#includeusingnamespacestd;classA{public:virtualvoidfunc1(){cout
以下关键字不能用来声明类的访问权限的是()。
下面叙述中错误的是()。
随机试题
A.丙基硫氧嘧啶B.他巴唑C.131I治疗D.甲状腺次全切除E.碘盐治疗
A.肱骨外科颈骨折B.肱骨干中上1/3骨折C.肱骨干中下1/3骨折D.伸直型肱骨髁上骨折可能损伤臂丛神经的骨折是
A.疏肝行气B.化湿行气C.活血行气D.燥湿行气E.健脾行气白豆蔻除温中止呕外,又能
A、马勃B、秦皮C、鸦胆子D、垂盆草E、地锦草某男,40岁。患湿热黄疸,昨日又被开水烫伤。治疗宜选用的药物是
下面对远期外汇交易的表述,正确的有()。
下列属于公司治理的基础设施的有()。
已知面条生重100克,煮熟后的重量为260克,计算面条的生熟重量比值。
Itisreportedthatthe______ofthecountry,fromhotelstotransport,isoldanddecrepit.
Customer:I’mlookingforanewlivingroomset.Salesman:Wehavealotofverynicesets.Whatstyledoyouhaveinmind?Cust
InawealthyneighbourhoodinSeoul,anxiousparentsdragfrightenedtoddlersintoDrNamWoo’sofficeanddemandthatheoperat
最新回复
(
0
)