首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类定义: class Person{ public: Person(string s):name(s) { } protected: string name;
有如下类定义: class Person{ public: Person(string s):name(s) { } protected: string name;
admin
2019-03-05
50
问题
有如下类定义:
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/jvAp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
在关系模型中,把数据看成一个二维表,每一个二维表称为一个______。
以下叙述正确的是
以下程序的输出结果是_____。#include<iostream.h>voidfun(){staticinta=0;a+=2;cout<<a<<"";}voidmain(
下面关于虚函数的描述中正确的是
模块独立性是软件模块化所提出的要求,衡量模块独立性的度量标准则是模块的
设有如下三个关系表:下列操作中正确的是()。
下列选项中不属于软件生命周期开发阶段任务的是
程序的结果为______。#include"iostream.h"template<typenameT>Ttotal(T*data){Ts=0;while(*data){S+=*da
下面说法正确的是
在E-R图中,用来表示实体联系的图形是
随机试题
《诗经》中的“六义”,指“风”“雅”“颂”三种诗歌形式与赋、________、兴三种表现手法。
市场因子即指能够明显引起某种产品市场需求变化的实际因素。()
某住宅建筑工地夜间进行混凝土施工作业,施工场界噪声经测试为70dB,严重影响了周围居民的休息。该施工单位未办理过任何夜间施工手续并公告附近居民。对此,下面说法错误的是()。
在下列各项中,具有流动性强的特点,可以作为立即投入流通的交换媒介的是______。
某机构投资者对已在上海证券交易所上市的A公司进行调研时,发现A公司如下信息:(1)甲为A公司的实际控制人,通过B公司持有A公司34%的股份。甲担任A公司的董事长、法定代表人。2009年8月7日,经董事会决议(甲回避表决),A公司为B公司向C银行借款400
下列符合现代教育制度的发展趋势的有()。
当代中国经济正在发生的三个根本性转变是()。
以下哪些思想家将法的本质归结为理性()
Asmanypeoplehitmiddleage,theyoftenstarttonoticethattheirmemoryandmentalclarityarenotwhattheyusedtobe.We
A、ItisthebestuniversityinCanada.B、ItissecondtoMcGillUniversityinresearchperformance.C、Itisnotedforcurricula
最新回复
(
0
)