阅读程序,写出运行后的输出结果。 #include<iostream> using namespace std; class A { public: ~A(){cout<<"A";} }; class B :public A { public: ~B(){cout<<"B";} }; void main() { B b1; }

阅读程序,写出运行后的输出结果。 #include<iostream> using namespace std; class A { public: ~A(){cout<<"A";} }; class B :public A { public: ~B(){cout<<"B";} }; void main() { B b1; }


参考答案和解析
B

相关考题:

有如下程序: include using namespace std; class A { public: virtual void f(){cout 有如下程序:include<iostream>using namespace std;class A{public:virtual void f(){cout<<"1";}};class B:public A{public:B (){cout<<"2";}};class C:public B{public:virtual void f(){B::f();cout<<"3";}};int main(){A aa,*p;B bb;C cc;p=cc;p->f();return 0;}执行上面程序的输出是______。

若有如下程序:includeusing namespace std;class TestClass{public:void who(){cout 若有如下程序: #include<iostream> using namespace std; class TestClass { public: void who(){cout<<“TestClass”<<endl;} }; class TestClassl:public TestClass { public: void who(){cout<<“TestClassl”<<endl; int main() { TestCA.TestClasslB.TestClassC.0D.无输出

若有以下程序:include using namespace std;class Base{public: void who(){cout 若有以下程序:include <iostream>using namespace std;class Base{public:void who(){cout<<" Base"<<end1:}};class Derived1: public Base{public:void who(){ cout<<"Derived"<<end1;}};int main(){Base *p;Derived1 obj1;p=obj1;p->who();return 0;}则该程序运行后的输出结果是【 】。

程序的输出结果是【 】。 include using namespace std; class A{ int x; public: A(int 程序的输出结果是【 】。include <iostream>using namespace std;class A{int x;public:A(int x=1):x(x){cout<<x;}};void main(){A a,b(2),c(3);}

有如下程序: include using namespace std; class ONE { public: virtual void f() { 有如下程序:include <iostream>using namespace std;class ONE{public:virtual void f() { cout << "1"; }};class TWO: public ONE{public:TWO() { cout << "2"; }};class THREE: public TWO{public:virtual void f() {TWO::f(); cout << "3"; }};int main(){ONE aa, *p;TWO bb;THREE cc;p=cc;P->f();return 0;}执行上面程序的输出是【 】。

以下程序的执行结果为______。include using namespace std; class base { public: vir 以下程序的执行结果为______。include<iostream>using namespace std;class base{public:virtual void who(){cout<<"base class"<<endl;}};class derivel:public base{public:void who(){cout<<"d

有如下程序:include using namespace std;class Base{public:Base(){cout 有如下程序:#include <iostream>using namespace std;class Base{ public: Base(){cout<<"BB"; f(); } Void f(){cout<<"Bf"; }};class Derived: public Base{ public: Derived() { cout<<"DD"; } void f() { cout<<"Df"; }};int main() { Derived d; return 0; }执行上面的程序将输出( )。A.BBBfDDB.BBDfDDDfC.DDD.DDBBBf

在下面程序的画线处填上适当的内容,使程序执行后的输出结果为ABCD。 include using 在下面程序的画线处填上适当的内容,使程序执行后的输出结果为ABCD。include <iostream>using namespace std;class A{public:A( ){cout<<'A';}};class B: (11) {public:B( ){cout<<'B';}{;class C: (12) {public:C( ){cout<<'C';}};class D:public B,public C{public:D( ){cout<<'D';}};void main( ){D( );cout<<endl;}

有如下程序: include using namespace std; class A { public: 有如下程序: #include<iostream> using namespace std; class A { public: A(){cout<<"A";} }; class B<public:B(){cout<<"B";)); class C:public A { B b; public: C(){cout<<"C";} }; int main(){Cobj;retum 0;} 执行后的输出结果是A.CBAB.BACC.ACBD.ABC

有如下程序: include using namespace std; class BASE { public 有如下程序: #include<iostream> using namespace std; class BASE { public: ~BASE(){cout<<"BASE";} }; class DERIVED:public BASE { public: ~DERIVED(){cout<<"DERIVED";} }; int main(){DERIVEDx;retum 0;} 执行后的输出结果是A.BASEB.DERIVEDC.BASEDERIVEDD.DERIVEDBASE

如下程序的输出是includeusing namespace std;class Base{public:Base( ){cout 如下程序的输出是 #include<iostream> using namespace std; class Base{ public: Base( ){cout<<"BB";f( );} void f( ){cout<<"Bf";} }; class Derived:public Base{ public: Derived( ){eout<<"DD";} void f( ){cout<<"Df";} }; int main( ){Derived d;return 0;}A.BBBff)DB.BBDfDDDfC.DDD.DDBBBf

下列程序的输出结果为2,请将程序补充完整。 include using namespace std; class Basc 下列程序的输出结果为2,请将程序补充完整。include<iostream>using namespace std;class Basc{public:【 】void fun(){cout<<1;}};class Dcrived:public Base{public:void fun(){cout<<2;}};int main(){Base*p=new Derived;p->fun();delete p;return 0;}

有如下程序:include using namespace std;class Base{public:Base(){ cout 有如下程序: #include <iostream.h> using namespace std; class Base { public: Base(){ cout<<"BB"; f(); } voidf(){cout <<"Bf"; } }; class Derived: public Base { public: Derived (){cout<<"DD";} void f(){cout<<"Df";} }; int main(){Derived d; return 0;} 执行上面的程序将输出A.BBBfDDB.BBDfDDDfC.DDD.DDBBBf

有如下程序:include using namespace std;class BASE{public:~BASE(){cout 有如下程序: #include <iostream> using namespace std; class BASE{ public: ~BASE(){cout<<"BASE";} }; class DERIVED:public BASE{ public: ~DERIVED(){cout<<"DERIVED";} }; int main(){DERIVED x;return 0;} 执行后的输出结果是A.BASEB.DERIVEDC.BASEDERIVEDD.DERIVEDBASE

如下程序的输出结果是includeusing namespace std;class A{public:A( ){cout 如下程序的输出结果是 #include<iostream> using namespace std; class A{ public: A( ){cout<<"A";} }; class B{public:B( ){cout<<"B";}}; class C:public A{ B b; public: C( ){cout<<"C";} }; int main( ){C obj;return 0;}A.CBAB.BACC.ACBD.ABC

有如下程序:includeusing namespace std;class A{public:A(){cout 有如下程序: #include<iostream> using namespace std; class A { public: A(){cout<<"A";} }; class B{public:B(){cout<<"B";} }; class C:public A { B b; public:C(){cout<<"C";} }; int main() { C obj; return 0; } 执行后的输出结果是( )。A.CBAB. BACC.ACBD.ABC

执行如下程序将输出():includeusing namespace std;class Base{public:Base(){cout 执行如下程序将输出( ): #include<iostream> using namespace std; class Base { public: Base(){cout<<"BB";fun();} void fun (){tout<<"Brim";} }; class Derived:public Base { public: Derived(){cout<<"DD";} void fun (){cout<<"Dfun";} }; int main(){Derived d;return 0;}A.DDB.BBDfunDDDfunC.BBBfunDDD.DDBBBfun

有如下程序:include using namespace std;class AA{public: virtual void f() {cout 有如下程序: #include <iostream> using namespace std; class AA { public: virtual void f() { cout<< "AA"; } }; class BB : public AA { public: BB() { cout << "BB"; } }; claA.AAB.AABBCCC.BBAABBCCD.BBBBAACC

下面程序的运行结果为( )。 include using namespace std; class A{ pu 下面程序的运行结果为( )。 #include <iostream> using namespace std; class A{ public: A(){cout<<" ";} ~A(){cout<<" ";} } class B:public A{ public: B(){cout<<" ";} ~B(){cout<<" ";} } void main(){ B b; }A.1234B.1324C.1342D.3142

下面程序输出的结果是【 】。 include using namespace std; class A { public:virtual 下面程序输出的结果是【 】。include <iostream>using namespace std;class A {public:virtual void show() {cout<<"A!";};class B: public A {public:void show() {cout << "B!";}};class C: public B{public:void show(){cout << "C!";}};void show_info(A i) {i. show();}void main() {A ia; B ib; C ic; show_info(ia);show_info(ib); show_info(ic); }

有以下程序:include using namespace std;class A{public: virtual void show() {cout 有以下程序:include <iostream>using namespace std;class A{public:virtual void show(){cout<<"A";}};class B : public A{public:void show(){cout << "B";}};void display( A * obj ){obj-> show();}int main ( ){A demol;B demo2;display( demol );display( demo2 );return 0;}执行后的输出结果为【 】。

有如下程序: inClude using namespace std; class AA { public: viltual void f() { c 有如下程序:inClude<iostream>using namespace std;class AA{public:viltual void f(){cout<<"AA";}};class BB:public AA{public:BB(){cout<<"BB";}};class CC:public BB{public:virtual void f(){BB::f();cout<<"CC";}};int main(){AA aa,*p;BB bb;CC cc;p=cc;p->f();return 0;}运行后的输出结果【 】。

有如下程序:include using namespace std;class A {public: A() {cout 有如下程序: #include <iostream> using namespace std; class A { public: A() {cout<<"A";} }; class B {public:B() {cout<<"B";}}; class C: public A { Bb; public: C() {cout<<"C";} }; int main() {C obj;return 0;}执行后的输出结果是 ______。A.CBAB.BACC.ACBD.ABC

下面程序的输出结果是()。include using namespace std;class A {public:A( ) {cout 下面程序的输出结果是( )。 #include <iostream> using namespace std; class A { public: A( ) {cout<<"A";} } class B { public: B() {coat<<"B" ;} } class C: public A { public: B b; C() {cout<<"C";} } void mian(){ C c; }A.CBAB.ABCC.ACBD.BCA

要使程序执行后的输出结果为ABCD,应在横线处添加语句()。includeusing namespace std; 要使程序执行后的输出结果为ABCD,应在横线处添加语句( )。 #include<iostream> using namespace std; { public:A(){cout<<'A';} }; class B=______ { public:B(){cout<<'B';} }; class C:virtual public A { public:C(){cout<<'C';} }; class D:public B,public C { public:D(){cout<<'D';} }; void main(){D obj;}A.public AB. private AC.protected AD.virtual public A

有如下程序:includeusing namespace std;class A{public: A(){cout 有如下程序: #include<iostream> using namespace std; class A{ public: A(){cout<<"A";} }; classB{public:B().{cout<<"B";}} classC:public A{ B b; public: C(){cout<<"C";} }; int main (){ C obj; return 0;} 执行后的输出结果是A.CBAB.BACC.ACBD.ABC

有如下程序:include using namespace std;class A{public:A(){cout 有如下程序: #include <iostream> using namespace std; class A { public: A(){cout<<"A";} }; class B {public:B(){cout<<"B";} }; class C:public A { B b; public:C(){cout<<"C";} }; int main(){C obj;return 0;} 执行后的输出结果是( )。A.CBAB.BACC.ACBD.ABC

在下面程序的横线处填上适当的内容,使程序执行后的输出结果为ABCD。 include using nam 在下面程序的横线处填上适当的内容,使程序执行后的输出结果为ABCD。include<iostream>using namespace std;class A{public: A(){cout<<'A';}};class B:【 】{public:B(){cout<<'B';)};class C:【 】{public;C(){cout<<'C';}};class D:public B,public C{public:D(){cout<<'D';}};void main(){D obi;}