首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
在下面横线上填上适当的语句,完成程序。 #include <iostream> using namespace std; class Base { int x; public:
在下面横线上填上适当的语句,完成程序。 #include <iostream> using namespace std; class Base { int x; public:
admin
2010-03-29
16
问题
在下面横线上填上适当的语句,完成程序。
#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/CNjp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
设q1和q2是指向一个int型一维数组的指针变量,k为float型变量,下列不能正确执行的语句是()。
有以下程序:#include<stdio.h>main(){inta=7;while(a--);pfinff(’’%d\n’’,a);}程序运行后的输出结果是()。
给定程序中,函数fun的功能是:有NxN矩阵,根据给定的m(m
设变量均已正确定义,若要通过scanf("%d%c%d%c",&a1,&c1,&a2,&c2);语句为变量a1和a2赋数值10和20,为变量c1和c2赋字符X和Y。以下所示的输入形式中正确的是()。(注:□代表空格字符)
有以下函数:intaaa(char*s){char*t=s;while(*t++);t--;return(t-s);}以下关于aaa函数功能叙述正确的是()。
设有以下语句:charx=3,y=6,z;z=x^y
交换两个变量的值,不允许用临时变量,应该使用下列()位运算符。
数据库系统在其内部具有3级模式,用来描述数据库中全体数据的全局逻辑结构和特性的是()。
在排序过程中,每一次数据元素的移动会产生新的逆序的排序方法是
设栈的顺序存储空间为S(1:50),初始状态为top=0。现经过一系列入栈与退栈运算后,top=20,则当前栈中的元素个数为
随机试题
简述刑事诉讼法规定的一审判决的种类。(中国人民大学2001年法学硕士研究生入学考试试题)
Ifonlythecommittee______theregulations(规章)andputthemintoeffectassoonaspossible.
对于化学反应:Cl2+6NaOH=NaClO3+5NaCl+3H2O,下列评述中,Cl2在该反应中所起的作用的正确评述是()。
下列关于销售收入的确认和计量的表述中,不正确的有()。
以下关于代理人在审核原始凭证的时候应该注意的审核描述不正确的是()。
爱岗敬业是教师职业首先的本质要求,下列反映爱岗敬业的有()。
汉谟拉比
是否应该废除死刑,在一些国家一直存在争议。以下是相关的一段对话:史密斯:一个健全的社会应当允许甚至提倡对罪大恶极者执行死刑。公开执行死刑通过其震慑作用显然可以减少恶性犯罪,这是社会自我保护的必要机制。苏珊:您忽视了讨论这个议题的一个前提
Eventhoughcurrenttechnologiesmaketheultimatesegmentednetworkimpractical,newtechnologiesandproductsholdthepromise
______ofthestudentsinourclassarefromthenorth.
最新回复
(
0
)