首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #inc1ude <iostream> using namespace std; class Basel{ public: Basel(int d) {cout<<d;} ~Basel(){}
有如下程序: #inc1ude <iostream> using namespace std; class Basel{ public: Basel(int d) {cout<<d;} ~Basel(){}
admin
2020-11-11
32
问题
有如下程序:
#inc1ude <iostream>
using namespace std;
class Basel{
public:
Basel(int d) {cout<<d;}
~Basel(){}
};
class Base2{
public:
Base2(int d) {cout<<d;}
~Base2(){}
};
class Derived: public Basel, Base2{
public:
Derived (int a,int b,int c,int d);
Basel(b), Base2(a), bl(d), b2(c) {}
Private:
int b1;
int b2;
};
int main(){
Derived d(1,2,3,4);
retum 0;
}
运行时的输出结果是( )。
选项
A、1234
B、2134
C、12
D、21
答案
D
解析
程序在创建派生类对象d时,分别调用基类Basel和Basel的构造函数。
转载请注明原文地址:https://kaotiyun.com/show/CSyp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
下列程序的输出结果是()。#include<iostrearn.h>voidmain(){intn[][3]={10,20,30,40,50,60};int(*p)[3];p=n;cout<<p[0][0
有如下程序:#include<iostrcam>usingnamespacestd;classAA{intn;public:AA(intk):n(k){}intget(){
有如下程序#inelude<iostream>usingnamespacestd;intmain(){chara;cin>>a;if(a=’*’)cout<<’’***’’<<end1
下列有关内联函数的叙述中,正确的是()。
有如下程序:#inc1ude<iostream>usingnamespacestd;c1assComp1ex{doublere,im;public:Comp1ex(double
若MyClass为一个类,执行“MyClassa[41,*p[5];"语句时会自动调用该类构造函数的次数是()。
若对数组进行初始化,下列选项中,错误的是()。
关于运算符重载,下列表述中正确的是
请打开考生文件夹下的解决方案文件proj3,其中定义了用于表示特定数制的数的模板类Number和表示一天中的时间的类TimeOfDay;程序应当显示:01:02:03.00406:04:06.021但程序中有缺失部分,请按照以下的提示,把缺失部分补充
随机试题
公民、法人或者其他组织认为行政机关和行政机关工作人员的行政行为侵犯其合法权益,有权依照本法向人民法院提起诉讼()
Everyday,over300childrenintheUnitedStatesages0to19aretreatedinanemergencydepartment,andtwochildrendie,as
国际规定冷水机组冷却水进口温度12℃,出口温度7℃。()
偏头痛颅内占位性头痛
关于肺结核的分类,错误的是
解磷定对哪一种农药中毒解救无效
热性病者宜健胃药宜
观察脑出血患者时,发现哪种情况常提示出血已止( )。【历年考试真题】
攀枝花金沙江河谷地带属于典型的()。
(36)一经各方商定同意纳入经济合同中,就成为各方必须共同遵守的技术依据,具有法律上的约束性。
最新回复
(
0
)