首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类定义: class Father{ //基类 public: Father(string s):name(s) { } private: stri
有如下类定义: class Father{ //基类 public: Father(string s):name(s) { } private: stri
admin
2021-09-05
29
问题
有如下类定义:
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://jikaoti.com/ti/cRh0FFFM
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有如下程序:#includeusingnamespacestd;intmain(){inti,s=0;for(i=1;s
有如下程序:#includeusingnamespacestd;classONE{intc;public:ONE():c(0){cout
有如下程序:#include<iostream>#include<iomanip>usingnamespacestd;intmain(){cout.fill(’*’);cout<<
在下列函数原型中,可以作为类AA构造函数的是()。
若有定义“intx=4,y=5;”,则表达式“y>x++?x--:y++”的值为()。
下列关于虚基类的描述中,错误的是()。
Sample是一个类,执行下面语句后,调用Sample类的构造函数的次数是()。Samplea[2],*P=newSample;
有三个关系R,S和T如下:其中关系T由关系R和S通过某种操作得到,该操作为()。
下面描述中错误的是()。
下列字符串中可以用作C++标识符的是
随机试题
电动葫芦的制动是靠()实现的。
Aresomepeopleborncleverandothersbornstupid?Orisintelligencedevelopedbyourenvironmentandourexperience?Strangel
硫酸镁没有的用途是
女,18岁。5天前出现右下颌智齿冠周炎,已行抗感染治疗3天。检查见开口度正常,第三磨牙正位,远中龈瓣覆盖部分牙面,上颌智齿正位萌出。该患者的最佳处理方法是
关于证据,以下说法正确的是:()
证券分析师不得断章取义或篡改有关信息资料,这是证券投资分析师的( )原则的内涵之一。
先秦诸子百家中,影响最大的自然要数儒、墨、道、法四家。但自秦汉大一统帝国形成之后,它们的命运开始分化:儒家成了中华文化的正统和主流;法家虽在舆论上不大受好评,但实际上主宰了两千年来专制朝廷的庙堂政治;与法家相反,道家则占据了民间社会的广阔天地,成为幽人隐士
实验证明,植物体内含有一种觉察光的蛋白质,可以“分辨”光的强弱。这种能力很可能使植物看到人类视力所看不到的波长,而且具有较高的灵敏度。植物能感觉光照射过来的方向,光使植物知道早上什么时候该醒来,同样也能促使植物额外分泌栎精和堪非醇这两种无色色素,他们能过滤
()是指在通信过程的任意时刻,信息既可由A传到B,又能由B传到A,但只能有一个方向的传输存在。
SERENDIPITOUS:CALCULATION::
最新回复
(
0
)