首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类定义: class Father{ //基类 public: Father(string s):name(s) { } private: stri
有如下类定义: class Father{ //基类 public: Father(string s):name(s) { } private: stri
admin
2019-04-18
80
问题
有如下类定义:
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/QpAp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
已知outfile是一个输出流对象,要想将outfile的文件指针定位到当前位置之前321字节处,正确的函数调用语句是
在表达式x-y中,“-”是作为非成员函数重载的运算符。若使用显式的函数调用代替直接使用运算符“-”,这个表达式还可以表示为
执行下列程序段以后程序的输出是______。voidadd(int&x){x++;}intmain(){inty=3;add(y);cout<<y<<end1;}
下列程序的输出结果为:0bjectid=00biectid=1请将程序补充完整。#include<iostream>usingnamespacestd;classPoint{publ
如下程序:#include<iostream.h>voidmain(){charstr[2][5]={"1234","5678"),*p[2];inti,j,s=0;for(i=0;i<2;i++)p[
软件生命周期可分为多个阶段,一般分为定义阶段、开发阶段和维护阶段。编码和测试属于______阶段。
执行以下程序,输出结果的最后一行语句是______。#include<iostream.h>classSample{ intx,y; public: Sample(){x=y=0;} Samp
C++中通常和一个运算符连用,构成一个运算符函数名的C++关键字为______。
重载的流运算符函数应该被定义为类的______函数。
随机试题
下列作家与其作品的对应,错误的是()。
幼年类风湿性关节炎湿热流注证的首选方剂是
下列关于完全抗原的说法,正确的是
对于薄钢板法兰的风管,其支、吊架间距不应大于()m。
作为工业生态链中的核心资源,应具有( )。
在有煤尘爆炸危险性的煤矿井下的采区巷道中,常可看到在一段巷道的顶部设置有岩粉棚或水棚,其目的是()。
装于机动车辆上的压缩式空调系统
由ETF基金标的指数调整而出现的现金替代属于()。
下列句子中,加下划线词语的意义解释正确的一项是()。
ThefactthatmostAmericansliveinurbanareasdoesnotmeanthattheyresideinthecenteroflargecities.Infact,moreAme
最新回复
(
0
)