首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
在下面横线上填上适当的语句,完成程序。 #include<iostream> using namespace std; class Base { int x; public: Base(int i){
在下面横线上填上适当的语句,完成程序。 #include<iostream> using namespace std; class Base { int x; public: Base(int i){
admin
2009-02-15
25
问题
在下面横线上填上适当的语句,完成程序。
#include<iostream>
using namespace std;
class Base
{
int x;
public:
Base(int i){x=i;}
~Base(){}
};
class Derived:public Base
{
public:
【 】 完成类Derive构造函数的定义
};
int main()
{
Derived Obj;
return 0;
}
选项
答案
Derived(int i):Base(i){}
解析
本题考核派生类中构造函数的的定义。程序中,类Derived是基类Base的公有派生。在类Derived的构造函数应该包括调用基类构造函数使基类的数据成员得以初始化。
转载请注明原文地址:https://kaotiyun.com/show/WOkp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
以下选项中能表示合法常量的是()。
有以下定义语句,编译时会出现编译错误的是()。
按照C语言规定的用户标识符命名规则,不能出现在标识符中的是( )。
请编写函数fun,函数的功能是:将M行N列自二维数组中的数据,按行的顺序依次放到一维数组中一维数组中数据的个数存放在形参n所指的存储粤元中。例如,二维数组中的数据为:333333334444
设循环队列的存储空间为Q(1:50),初始状态为front=rear=50。现经过一系列入队与退队操作后,front=rear=1,此后又正常地插入了两个元素。最后该队列中的元素个数为
计算机高级语言程序的运行方法有编译执行和解释执行两种,以下叙述中正确的是
C语言的逻辑表达式在特定情况下会产生“短路”现象。若有如下逻辑表达式: x++&&y++;则以下叙述中正确的是()。
数据库系统阶段的数据具有较高独立性,数据独立性包括物理独立性和【】两个含义。
数据库系统阶段的数据具有较高独立性,数据独立性包括物理独立性和______两个含义。
随机试题
汽车在装配中,同时采用_________工艺方法,可达到无泄漏的目的。
固涩剂的分类不包含
A.商丘B.丘墟C.照海D.申脉E.然谷在踝区,内踝尖下1寸,内踝下缘边际凹陷中的腧穴是
【背景资料】某段高速公路工程,路面面层为SMA沥青混凝土,基层为水泥稳定土基层,施工过程中,出现以下情况:情况一:由于本工程的路面属高级路面,所以采用水泥稳定细粒土做该路面的基层。情况二:在选择水泥时,施工单位选择了终凝时间较
()策略保证投资者有充足的资金可以满足预期现金支付的需要。这对于养老基金、社保基金、保险基金等机构投资者具有重要的意义,因为这类投资者对资产的流动性要求很高,其投资成败的关键在于投资组合中是否有足够的流动资产可以满足目前的支付。
向客户出借资金供其买人上市证券或者出借上市证券供其卖出,并收取担保物的经营活动属于()。
陈某向贺某借款20万元,借期2年。张某为该借款合同提供保证担保,担保条款约定,张某在陈某不能履行债务时承担保证责任,但未约定保证期间。陈某同时以自己的房屋提供抵押担保并办理了登记。抵押期间,谢某向陈某表示愿意以50万元购买陈某的房屋。根据《物权法》的规定,
卓越绩效评价在满分1000分的定量评分系统中,_________是一个基本成熟的等级。
根据下面材料回答下列题。根据上图,2008年到2012年间下列说法正确的是()。
Youaregoingtoreadamagazinearticleinwhichafatherdescribeshisrelationshipwithhisson.Forquestions8-14,chooset
最新回复
(
0
)