首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include<iostream> using namespace std; class Basel{ public: Base1(int d){cout<<d;} ~Base1(){} }; class Base2{ public: Ba
有如下程序: #include<iostream> using namespace std; class Basel{ public: Base1(int d){cout<<d;} ~Base1(){} }; class Base2{ public: Ba
admin
2015-11-24
64
问题
有如下程序:
#include<iostream>
using namespace std;
class Basel{
public:
Base1(int d){cout<<d;}
~Base1(){}
};
class Base2{
public:
Base2(int d){cout<<d;}
~Base2(){}
};
class Derived:public Base1,Base2{
public:
Derived(int a,int bint c,int d);
Base1(b),Base2(a),b1(d),b2(c){}
Private:
int b1;
int b2;
};
int main(){
Derived d(1,2,3,4);
return 0;
}
运行时的输出结果是( )。
选项
A、1234
B、2134
C、12
D、21
答案
D
解析
程序在创建派生类对象d时,分别调用基类Base1和Base1的构造函数。
转载请注明原文地址:https://kaotiyun.com/show/VlNp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
以下对C++语言函数的有关描述中,正确的是
设有程序段intk=10;while(k=0)k=k-1;则下面描述中正确的是
以下程序的输出结果是【】。#include<iostream>usingnamespacestd;voidfun(){staticinta=0;a+=2;cout<<a
重载输入流运算符>>必须使用的原型为
下列关于new运算符的描述中错误的是
下列叙述中正确的是
下列关于动态联编的描述中,错误的是()。
两个变量定义不能同名,是因为()。
下列引用的定义中,()是错误的。
随机试题
下列属于公务员不可放弃的权利是
二氯三氟乙烷CHCl2CF2的制冷剂代号是_______。
图示梁EI=常数,B端的转角是:
其他合作机构风险的防控措施包括()。
下列选项中,针对产品大类描述正确的是()。
我国国家领导人连续任职不得超过两届的有()。
APayRiseorNot?"UnlessIgetarise,I’llhaveatalkwiththeboss,HenryManley,"GeorgeStrongsaidtohimself.George
AwarmthoughtsuddenlyAcametomeBwhichImightCusethepocketmoneytobuysomeflowersDformymother’sbirthday.
Whattopicarethemanandwomandiscussing?
ShoppinghabitsintheUnitedStateshavechangedgreatlyinthelastquarterofthe20thcentury.【C1】______inthe1900smost
最新回复
(
0
)