首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类定义: class Father{ //基类 public: Father(string s):name(s) { } private: stri
有如下类定义: class Father{ //基类 public: Father(string s):name(s) { } private: stri
admin
2021-06-10
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、class Child
B、class Child:Father,Mother
C、class Child:public Father,Mother
D、class Child:public Father,public Mother
答案
B
解析
一个派生类同时继承两个或者多个基类时称为多重继承,其一般形式为:
class 派生类名:[继承方式]基类名1,[继承方式]基类名2,所以D选项正确。
转载请注明原文地址:https://kaotiyun.com/show/Pufp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
if(表达式1)语句1else语句2只有A选项是正确的要定义整型数组x,使之包括初值均为1的三个元素,下列语句正确的是
有如下类定义:classTest{public:Test(){a=0;c=0;}//①intf(inta)const{this一>a=a;}//②staticintg(){return
有如下程序:#includeusingnamespacestd;classObj{staticinti;public:Obj(){i++;}~Obj(){i--;}staticintgetVal(){ret
下面类的声明中的几个语句,正确的是(设定语句是主函数中的语句)()。classTestClass{private:intdata;public:TestClass(intg_data
请使用VC6或使用【答题】菜单打开考生文件夹proj2下的工程proj2,该工程中包含一个程序文件main.cpp,其中有类CPolygon(“多边形”)、CRectangle(“矩形”)、CTfiangle(“三角形”)的定义。请在横线处填写适当的代码并
有如下程序:#include<iostream>#include<string>usingnamespacestd;classMyBag{public:MyBag(stringbr,str
如下函数模板:templateTsquare(Tx){returnx*x;}其中T是()。
随机试题
有关超声雾化吸入目的,正确的叙述是
0.18~0.25mm1.0mm
下列属于风湿热增生期的表现的是
PCA(患者自控镇痛)的定义是
按税收负担能否转嫁,可将税收分为()。
以下选项中关于采用环形井点进行基坑降水施工说法正确的是()。
我国证券公司的设立实行审批制,由中国证监会依法对证券公司的设立申请进行审查,决定是否批准设立,未经中国证监会批准,任何单位和个人不得经营证券业务。()
根据贷款性质的不同,个人教育贷款可分为()。
Fromthechildtooldage,wealluselanguageasameansof【B1】______ourknowledgeofourselvesandtheworldaroundus.When
Thepassagegivesageneralexplanationaboutthebenefitsofacross-culturalmarriage.Fewstudiesfindthatadultlanguagel
最新回复
(
0
)