单项选择题
有如下程序: #include<iostream> using namespace std; class Basel{ public: Basel(int d) {cout<<d;} ~Base1(){} }; class Base2{ public: Base2(int d) {cout<<d;} ~Base2(){} }; class Derived:public Base1,Base2{ public: Derived(int a,int b,int 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
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
有如下类定义: class AA{ int a; Publie: AA(int n=0):a(n){} }; class BB:public AA{public: BB(int n)_________ }; 其中横线处缺失部分是( )。
A.:a(n){}
B.:AA(n){}
C.{a(n);}
D.{a=n;}
点击查看答案&解析
单项选择题
生成派生类对象时,派生类构造函数调用基类构造函数的条件是( )。
A.无需任何条件
B.基类中显示定义了构造函数
C.派生类中显式定义了构造函数
D.派生类构造函数明确调用了基类构造函数
点击查看答案&解析
相关试题
有如下程序: #include<iostream> usi...
有如下两个类定义 class xx{ private:...
有如下程序: #include<iostream> usi...
通过派生类的对象可直接访问其( )。
有如下类定义和变量定义: class Parents...