首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类定义: class Father{ //基类 public: Father(string s):name(s) { } private: stri
有如下类定义: class Father{ //基类 public: Father(string s):name(s) { } private: stri
admin
2020-06-29
49
问题
有如下类定义:
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、class Child
B、class Child:Father,Mother
C、class Child:public Father,Mother
D、class Child:public Father,public Mother
答案
D
解析
一个派生类同时继承两个或者多个基类时称为多重继承,其一般形式为:
class 派生类名:[继承方式]基类名1,[继承方式]基类名2,所以D选项正确。
转载请注明原文地址:https://kaotiyun.com/show/szyp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有如下程序:#includeusingnamespacestd;classTV{public:TV(ints=41):size(s){}
下列函数声明中,错误的是
请使用VC6或使用【答题】菜单打开考生文件夹proj2下的工程proj2,该工程中包含一个程序文件main.cpp,其中有日期类Date、人员类Person及排序函数sortByName和主函数main的定义。请在程序中的横线处填写适当的代码并删除横线,以
有如下类和变量定义:classParents{public:intpublicData;private:intprivateData;};
有如下程序:#include#includeusingnamespacestd;classPerson{public:Person(string
软件按功能可以分为:应用软件、系统软件和支撑软件(或工具软件)。下面属于应用软件的是( )。
下列语句中,错误的是()。
下列符号中能够作为C++标识符的是()。
定义无符号整数类为UInt,下面可以作为类UInt实例化值的是( )。
下列字符串中,不可以用做C++标识符的是()。
随机试题
产生“薄厥”的病因,多是
全血的黏滞性主要取决于
既能消食,又能回乳的药物是()
A.妊娠49天以前B.妊娠10周内C.妊娠10~14周D.妊娠15~24周E.妊娠14~28周
某农业企业为上市公司,企业所得税率为25%。2016年底,该企业所有者权益总额为68000万元,其中:股本5000万股,每股10元;资本公积9000万元;盈余公积7500万元;未分配利润1500万元。2017年8月,该企业向银行申请3年期借款3000万元,
在放射性及散发大量有害物的实验室应用()。
属于世界自然文化双重遗产的是()。
Parentslookingtosteertheirteensawayfromdrugsmaywanttoencouragethemstayinbedlonger.Lackofsleepseemstolead
Manyanimalshavesomelevelofsocialintelligence,allowingthemtocoexistandcooperatewithothermembersoftheirspecies.
简单的交换排序方法是()。
最新回复
(
0
)