网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

有如下程序: #include<iostroam> using namespace std; class Base{ protected: Base{cout<<’A’;} Base(char C){cout<<c;} }; class Derived:public Base{ public: Derived(char C){tout<<C;} }; int main{ Derived dl(’B’); retum 0; } 执行这个程序的输出结果是( )。

A.B

B.BA

C.AB

D.BB


参考答案

更多 “ 有如下程序: #includeiostroam using namespace std; class Base{ protected: Base{cout’A’;} Base(char C){coutc;} }; class Derived:public Base{ public: Derived(char C){toutC;} }; int main{ Derived dl(’B’); retum 0; } 执行这个程序的输出结果是( )。A.BB.BAC.ABD.BB ” 相关考题
考题 有如下程序#includeusing namespace std;class Base{protected;Base(){cout’A’;}Base(char c){cout};class Derived; public Base{public:Derived(char c ){cout };int main(){Derived d1(‘B’);return 0;}执行这个程序屏幕上将显示输出______。A.BB.BAC.ABD.BB

考题 ( 30 ) 有如下程序#includeusing namespace std;class Base {protected:Base( ){ cout'A'; }Base(char c){ cout};class Derived: public Base{public:Derived( char c ){ cout};int main( ){Derived d1('B');return 0;}执行这个程序屏幕上将显示输出A ) BB ) BAC ) ABD ) BB

考题 有如下程序 include using namespace std; class Base { protected: 有如下程序 #include <iostream> using namespace std; class Base { protected: Base( ){cout<<'A'; } Base(char c) { cout<<c; } }; class Derived: public Base { public: Derived(char c){ cout<<c; } }; int main( ){ Derived d1 ('B'); return 0; } 执行这个程序屏幕上将显示输出A.BB.BAC.ABD.BB

考题 下面程序的运行结果是()。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

考题 有如下程序:includeusing namespace std;class Base{protected:Base(){cout 有如下程序: #include<iostream> using namespace std; class Base{ protected: Base(){cout<<'Base';} Base(char c){cout<<c;} }; class Derived:public Base{ public: Derived(char c){cout<<c;} }; int main(){ Derived d('Derived'); return 0; } 执行这个程序屏幕上将显示输出( )。A.DerivedB.DerivedBaseC.BaseDerivedD.DerivedDerived

考题 下面程序的输出结果是【】。include using namespace std; class base { protected: int 下面程序的输出结果是【 】。include <iostream>using namespace std;class base{protected:int a;public:base(){cout<<"0":}};class basel: virtual public base{public:base1(){ cout<<"1";}};class base2 : virtual public base{public:base2(){cout<<"2";}};class derived : public base1,public base2{public:derived () {cout<<"3"; }}int main (){derived obj;cout<<end1;return 0;}

考题 下面程序的运行结果是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: base1( ){cout<<"1";} }; class base2:virtual base{ public:A.123B.3120C.312D.3012

考题 有如下程序: include using namespace std class Base{ int b; public: Base(int i) { 有如下程序:include<iostream>using namespace stdclass Base{int b;public:Base(int i) {b=i;}Void disp ( ) {cout<<"Base:b="<<b<<''; }};class Base1:virtual public Base{public:Base1(int i):Base(i){}};class Base2:virtual public Base{public:Base2(int i):Base(i){}};class Derived:public Basepublic Base1{int d;public:Derived(int i ,int j):Base1(j),Base2(j),【 】{ d=i; }void disp() {cout<<"Derived:d="<<d<<' ';}};int main()Derived objD(1,2);objD. disp()objD. Base::disp();objD. Base1::disp()objD. Base2::disp();return 0;}请将程序补充完整,使程序在运行时输出:Derivd:d=1 Base:b=2 Base:b=2 Base:b=2

考题 有如下程序includeusing namespace std;class Base{protected:Base(){cout 有如下程序 #include<iostream> using namespace std; class Base{ protected: Base(){cout<<'A';} Base(char c){cout<<c;) }; class Derived: public Base{ public: Derived(char c){cout<<c;) }; int main(){ Derived dl('B'); return 0; } 执行这个程序屏幕上将显示输出( )。A.BB.BAC.ABD.BB