有如下程序: #includeiostream using namespace std; class Basel { public: BaseI(int D.{coutd;} 一Basel{} }; class Base2 { public: Base2(int D.{toutd;} ~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 bl: int b2: }; int main { Derived d(1,2,3,4); return 0; } 执行这个程序的输出结果是( )。A.1234B.2134C.12D.21
有如下程序: #include<iostream> using namespace std; class Basel { public: BaseI(int D.{cout<<d;} 一Basel{} }; class Base2 { public: Base2(int D.{tout<<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 bl: int b2: }; int main { Derived d(1,2,3,4); return 0; } 执行这个程序的输出结果是( )。
A.1234
B.2134
C.12
D.21
相关考题:
下面程序的运行结果是 include class base{ protected: int a; public: base( ) {c 下面程序的运行结果是#include<iostream.h>class base{protected:int a;public:base( ) {cout < < "0";}};class base l: virtual base{public:base l ( ) {cout < <"1";}};class base 2: virtual base{public:base2 ( ) {cout < <"2";}};class derived: public base 1, public base2{public:derived( ) {cout < < "3";}};void main( ){derive obj;cout < < endl;}A.0123B.3120C.0312D.3012
下面程序的运行结果是()。includeclass base{protected:int a;public:base(){cout 下面程序的运行结果是( )。 #include<iostream.h> class base{ protected: int a; public: base(){cout<<“0”;} }; Class basel:Virtual base{ public: basel(){cout<<“1”;} }; Class base2:virtual base{ public: base2(){cout<<“2”;)A.0123B.3120C.0312D.3012
有如下程序; #includeiostream usingnamespacestd; clasBasel{ public: Basel(intd){coutd;} -Basel(){} }; classBase2{ public: Base2(intd){outd;} ~Base2(){} }; classDerived:publicBase1,Base2{ public: Derived(inta,intb,intC,intd): Basel(b),Base2(a),b1(d),b2(c){} private: intb1; intb2; }; intmain(){ Derivedd(1,2,3,4); return0; } 运行时的输出结果是( )。A.1234B.2134C.12D.21
下面程序的运行结果是( )。#includeiostream.hclassbase{protected:inta;public:base(){cout0;}};classbasel:virtualbase{public:basel(){cout1;}};classbase2:virtualbase{public:base2(){cout2;}};classderived:publicbasel,publicbase2{public:derived(){cout3;}};voidmain(){derivedobj;coutendl;}A.0123B.3120C.0312D.3012
请将如下程序补充完整,使得输出结果为:bbaa。 include using naluespace std; class 请将如下程序补充完整,使得输出结果为:bbaa。include<iostream>using naluespace std;class A{public:______{eout<<"aa";}};class B:public A{public:~B( ){eont<<"bb";}};int ulain( ){B*P=new B;delete P;return 0;}
下面程序的运行结果是( )。 #includeiostream.h classbase{ protected: inta; public: base(){cout"0";} }; classbasel:virtualbase{ public: basel(){cout"1";} }; classbase2:virtualbase{ public: base2(){cout"2";} }; classderived:publicbasel,publicbase2{ public: derived(){cout"3";} }; voidmain() { derivedobj; eoutendl: }A.0123B.3120C.O312D.3012
下面程序的运行结果是( )。 #includeiostream.h class base{ protected: int a; public: base{cout”0”;} }; class basel:virtual base{ public: basel{cout”1”;} }; class base2:virtual base i public: base2{cout”2”;} }; class derived:public basel,public base2{ public: derived{cout”3”;} }; void main derived obj; coutendl:A.0123B.3120C.0312D.3012
下面程序的运行结果是includeclass base{protected: int a;public: base(){cout 下面程序的运行结果是 #include<iostream.h> class base{ protected: int a; public: base(){cout <<"0";} }; class basel:virtual base{ public: basel () {cout <<"1";} }; class base2:virtual base{ public: base2(){cout <<"2";} }; class derived:public basel,public base2{ public: derived(){cout <<"3";} }; void main() { derived obj; cout <<end1; }A.123B.3120C.312D.3012
阅读下列说明和C++代码,填写程序中的空(1)~(6),将解答写入答题纸的对应栏内。【说明】以下C++代码实现一个简单绘图工具,绘制不同形状以及不同颜色的图形。部分类及其关系如图6-1所示。【C++代码】#include?#include?using?namespace?std;class?DrawCircle?{??????//绘制圆形,抽象类? ? ? public: (1);//定义参数为?int?radius,?int?x,?inty? ?virtual~DrawCircle()?{?}};class?RedCircle:public?DrawCircle?{????//绘制红色圆形? ? ? ? public: void?drawCircle(intradius,?int?x,?int?y)?{cout??drawCircle?=?drawCircle;? }? ?virtual~shape()?{?}? public:? ?virtual?void?draw()?=?0;};class?Circle:public?Shape?{????//圆形? ? private:? ? ?int?x,y,radius;? ? public:? Circle(int?x,inty,int?radius,DrawCircle?*drawCircle)? (3)? {? this->x?=?x;? ?this->y?=?y;? ? this->radius?=?radius; }? ? ? public:? void?draw(){? drawCircle?-> (4); }};int?main(){Shape?*redCirclenew?Circle(100,100,10,????(5)????);//绘制红色圆形? Shape?*greenCircle=new?Circle(100,100,10, (6)??);//绘制绿色圆形redCircle >draw();? ?greenCircle?->draw();? ?return?0;}