首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类定义: class Father{ //基类 public: Father(string s):name(s) { } private: stri
有如下类定义: class Father{ //基类 public: Father(string s):name(s) { } private: stri
admin
2021-09-05
36
问题
有如下类定义:
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/54fp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
下列语句中,错误的是()。
有如下程序:classBase{public:intdata;);classDerivedl:publicBase{};classDerived2:protectedBase{};
有如下程序:#includeusingnamespacestd;classMyClass{public:MyClass(){++count;}~MyClass(){--count;}
下面叙述错误的是()。
下面程序中对一维坐标点类Point进行运算符重载#inc1ude<iostream>usingnamespacestd;c1assPoint{public:Point(intval){x=val,)
在公有继承的情况下,允许派生类直接访问的基类成员包括()。
下列语句中,正确的是()。
有如下类定义:classPoint{private:staticinthow_many;};_________how_many=0;要初始化Point类的静态成员how_many,下画线处应
对于循环队列,下列叙述中正确的是()。
有三个关系R、S和T如下:由关系R和S通过运算得到关系T,则所使用的运算为()。
随机试题
党的十九大明确指出,我国社会主要矛盾是()
外观检验不能发现的焊缝缺陷是()。
使用Mowry阿尔辛蓝过碘酸希夫(ABPAS)染色法进行黏多糖染色时,中性和酸性混合物质呈
胃蛋白酶原的激活物是
A.血清胆红素≥85μmol/LB.血清胆红素≤171μmol/LC.血清胆红素≤205μmol/LD.血清胆红素>256.5μmol/LE.血清胆红素>342μmol/L当发生胆红素脑病()。
燃气管道及其附件组装完成并试压合格后,应进行通球扫线,每次吹扫管道长度不宜超过()km。
如果A、B两只股票的收益率变化方向和变化幅度完全相同,则由其组成的投资组合()。
Inordertosurvive,tofeed,clotheandshelterhimselfandhischildren,manisengagedinaconstantstrugglewithnature.
我国历史上第一部社会主义类型的宪法是()。
A.sothatB.preferenceC.normalD.circleE.callsforF.problemG.longerH.cycleI.matterJ.illustratesK.hand
最新回复
(
0
)