首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类定义: class Father{ //基类 public: Father(string s):name(s) { } private: stri
有如下类定义: class Father{ //基类 public: Father(string s):name(s) { } private: stri
admin
2021-05-06
37
问题
有如下类定义:
class Father{ //基类
public:
Father(string s):name(s) { }
private:
string name;
};
class Mother{ //基类
public:
Mother(string s):name(s) { }
private:
string name;
};
___________________________{ //Father和Mother的派生类
public:
Child(string s1,string s2,string s3):Father(s1),Mother(s2),name(s3) { }
private:
string name;
};
若派生类Child从基类Father和基类Mother处公有继承,则横线处缺失的部分是
选项
A、classChild
B、classChild:Father,Mother
C、classChild:publicFather,Mother
D、classChild:publicFather,publicMother
答案
D
解析
一个派生类同时继承两个或者多个基类时称为多重继承,其一般形式为:class派生类名:[继承方式]基类名1,[继承方式]基类名2,所以D选项正确。
转载请注明原文地址:https://kaotiyun.com/show/NXfp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
若有如下类定义:classB{voidftmlO{)protected:doublevarl;public:voidfun20{});classD:publicB{
有如下程序:#inc1ude<iostream>usingnamespacestd;classVAC{public;intf()const{return3;}intf(){retu
已知枚举类型声明语句为:enumCOLOR{WHITE,YELLOW,GREEN=5,RED,BLACK=10}:则下列说法中错误的是()。
有以下程序:usingnamespacestd;{public:TestClass(intr1,intr2){R1=r1;R2=r2;}voidprint();
下面是重载为非成员函数的运算符函数原型,其中错误的是
下面描述中,不属于软件危机表现的是()。
若要重载+、=、<<、==和口运算符,则必须作为类成员重载的运算符是()。
在下列枚举符号中,用来表示“相对于当前位置"文件定位方式的是()。
公司中有多个部门和多名职员,每个职员只能属于一个部门,一个部门可以有多名职员。则实体部门和职员间的联系是()。
随机试题
对货币资产进行评估时,其评估依据为()
急性白血病易发生感染,主要由于
对左侧忽略患者的训练不正确的是
某混凝土大坝主体工程,建设单位将土建工程、安装工程分别发包给甲、乙两家施工单位。在合同履行过程中发生了如下事件:事件1:项目监理机构在审查土建工程施工组织设计时,认为脚手架工程危险性较大,要求甲施工单位编制脚手架工程专项施工方案。甲施工单位项目经理部编制
下列住宅建筑安全出口,疏散楼梯和户门的设计方案中,正确的有()。
世界贸易组织总部位于___________,其宗旨是___________。
抽象逻辑思维
Sinceitsearlyappearanceinthe1960s,theterm"globalization"hasbeenusedinbothpopularandacademicliteraturetodescr
Mostworkersspendeightorninehoursonthejob.Theywork【C1】______it’sunavoidable.Theyneedtomakeenoughmoneyfor【C2】_
MPLS技术的核心是【】交换。
最新回复
(
0
)