首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类定义: class Person{ public: Person(string s):name(s) { } protected: string name;
有如下类定义: class Person{ public: Person(string s):name(s) { } protected: string name;
admin
2015-06-27
68
问题
有如下类定义:
class Person{
public:
Person(string s):name(s) { }
protected:
string name;
};
class Father:virtual public Person{
public:
Father(string s):Person(s) { }
};
class Mother:virtual public Person{
public:
Mother(string s):Person(s) { }
};
class Child:public Father,public Mother,virtual public Person{
public:
Child(string s1,string s2,string s3):Mother(s1),Father(s2),Person(s3) { }
};
在建立派生类Child的对象时,其基类Father、Mother和Person的构造函数的调用顺序为
选项
A、Father,Mother,Person
B、Mother,Father,Person
C、Person,Father,Mother
D、Father,Person,Mother,Person,Person
答案
C
解析
执行派生类构造函数的顺序是:1、调用基类构造函数,2、调用子对象构造函数,3、再执行派生类构造函数,所以本题中先调用基类person构造函数,然后执行father构造函数,最后执行mother构造函数。
转载请注明原文地址:https://kaotiyun.com/show/7nBD777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
下列关于新教育发展时期的说法错误的是
皮亚杰所谓的“具体运算阶段”是指()
20世纪60年代,英国()建议应为所有在能力和成绩方面合格的,并愿意接受高等教育的人提供高等教育课程,为此英国兴办了许多大学。
生物起源说和心理起源说的根本错误在于否认了教育的
关于非正规教育的说法,下列说法错误的是
某企业为增值税一般纳税人,购销货物的增值税税率均为17%,2010年1月发生如下经济业务:(1)购进货物取得的增值税专用发票上注明的货物金额为400万元,增值税为68万元;同时支付货物运费4万元,建设基金1000元,装卸费200元,运输途中保险费200
标志着中国古代重实体、轻程序传统的终结的法典是()
下列叙述中,正确的是()。
下列关于boolean类型的叙述中,正确的是()。
随机试题
其法律效力仅次于宪法的我国法的渊源有()。
—Is______here?—No,BobandTimaskedforleave.
会计主管可以兼任电算化主管。()
成本计算分批法的特点有()。
阅读分析短稿,并按照稿件加工整理的规范进行编辑加工。编辑工作是整个出版工作的中心环节,这是出版工作的规模、特点所决定的。出版工作的社会效益和经济效益主要通过出版物的精神文化内容来实现,而出版物的精神文化内容要通过编辑的选题设计和对稿件的组织、审读、
在管理手段上,现代人力资源管理()。
最近几年,网红食品________。为了买到一杯奶茶、一块蛋糕,人们愿意花上几个小时排队,甚至出高价从“黄牛”手中拿货,拿到美食后,再拍照上传到社交平台“打卡”……这已经成为时下许多年轻人的饮食新时尚。但必须注意到的是,部分商家在追求利益的同时无视食品安全
Stratford-on-Avon,asweallknow,hasonlyoneindustry—WilliamShakespeare—buttherearetwodistinctlyseparateandincreasingl
A、Toshowthatthenewmethodwillnotcausefire.B、Topointoutthedangeroftheoldmethod.C、Toexplainastepinthenewt
【S1】【S5】
最新回复
(
0
)