有如下程序: #includeiostream using namespace std; class A{ public: virtual void fancl{cout”Al”;} void func2{cout”A2”;} }; class B:public A{ public: void funcI{tout”Bl”;} void func2{tout”B2”;} }; intmain} A*P=new B: P—funcl; P—func2; delete p; return 0; } 执行这个程序的输出结果是( )。A.B182B.A1A2C.B1A2D.AIB2

有如下程序: #include<iostream> using namespace std; class A{ public: virtual void fancl{cout<<”Al”;} void func2{cout<<”A2”;} }; class B:public A{ public: void funcI{tout<<”Bl”;} void func2{tout<<”B2”;} }; intmain} A*P=new B: P—>funcl; P—>func2; delete p; return 0; } 执行这个程序的输出结果是( )。

A.B182

B.A1A2

C.B1A2

D.AIB2


相关考题:

有以下程序: included using namespace std; class Base { public: Base( ) { x=0; } 有以下程序:included<iostream>using namespace std;class Base{public:Base( ){x=0;}int x;};class Derived1:virtual public Base{public:Derived1( ){x=10;}};class Derived2:virtual public Base{public:Derived2( ){x=20;}};class Derived: public Derived1,protected Derived2{ };int main( ){Derived obj;cout<<obj. x<<endl;return 0;}该程序运行后的输出结果是______。

有如下程序: include using namespace std; class Sample{ public: 有如下程序: #include<iostream> using namespace std; class Sample{ public: Sample()<) ~Sample(){cout<<'*';} }; int main(){ Sample temp[2],*pTemp[2]; return 0; } 执行这个程序输出星号(*)的个数为( )。A.1B.2C.3D.4

有如下程序: 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 GA{public:virtual int f( ){return 1 有如下程序: #include<iostream> using namespace std; class GA{ public: virtual int f( ){return 1;} }; class GB:public GA{ public: virtual int f( ){return 2;} }; void show(GA g){eout<<g.f( );} void display(GA&g){cout<<g.f( );} int main( ){ GA a;show(A) ;display(A) ; GB b;show(B) ;display(B) ; return 0; } 程序的输出结果是A.1111B.1211C.1112D.1212

有如下程序:inCludeusing namespace std;Class TestClass{public:virtUal void furll 有如下程序: #inClude<iostream> using namespace std; Class TestClass {public: virtUal void furll() {cout<<“funlTestclass”;} virtual void fun2() {cout<<“{fun2TestClass”;}}; class TestClassl:public TestClass {void fun() {cout<<“fuA.fun1TestClass1 fun2TestClassB.fun1TestClass1 fun2TestClass1C.fUnlTestClass fun2TestClassD.funlTe3tClass fun2TestClassl

以下程序的执行结果为______。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 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

请将如下程序补充完整,使得输出结果为:bbaa include using namespace std; class A { 请将如下程序补充完整,使得输出结果为:bbaainclude <iostream>using namespace std;class A {public:【 】{cout << "aa"; }};class B: public A{public:~B(){ cout << "bb"; }};int main () {B *p= new B;delete p;return 0;}

有以下程序:include using namespace std; class Base { public: Base() { K=0; } int 有以下程序:include<iostream>using namespace std;class Base{public:Base(){K=0;}int x;};class Derivedl:virtual public Base{public:Derivedl(){x=10;}};class Derived2:virtua1 public Base

有如下程序: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 TestClass1{public:virtual void fun( 有如下程序: #include<iostream> using namespace std; class TestClass1 { public: virtual void fun(){cout<<"1";} }; class TestClass2: public TestClass1 { public: TestClass2(){cout<<"2";} }; class TestClass3:public TestClass2 { public: virtual void fun(){TestClass2::fun();cout<<"3";} }; int main() { TestClass 1 aa,*p; TestClass2 bb; TestClass3 cc; p=cc; P->fun(); return 0; } 执行上面程序的输出是( )。A.1122B.2112C.2213D.2223

如下程序的输出结果是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<<"BASE";} }; class DERIVED:public BASE{ public: ~DERIVED( ){cout<<"DERIVED";} }; int main( ){DERIVED x;return 0;} 程序的输出结果是A.BASEB.DERIVEDC.BASEDERIVEDD.DERIVEDBASE

下面程序的输出结果是【】。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;}

有如下程序:includeusing namespace std;class XX{protected;int k;public:XX(int n= 有如下程序: #include<iostream> using namespace std; class XX{ protected; int k; public: XX(int n=5):k(n){} ~XX(){cout<<"XX";} Virtual void f()cons=0; }; inline void XX::f()const{cout<<k+3;} class YY:public XX{ public:A.28XXB.28YYXXC.-33XXD.-33XXYY

有如下程序: include using namespace std; class PARENT { public: PARENT() { cout 有如下程序:include <iostream>using namespace std;class PARENT{public:PARENT() { cout <<"PARENT"; }};class SON : public PARENT{public:SON() {cout << "SON"; }};int main(){SON son;PARENT *p;p = son;return 0;}执行上面程序的输出是______。

有如下程序includeusing namespace std;class GA{public:virtual int f( ) {return 1 有如下程序 #include<iostream> using namespace std; class GA{ public: virtual int f( ) {return 1;} }; class GB:public GA{ public: virtual int f() {return 2;} }; void show(GA g){cout<<g.f();} void display(GAg){cout<<g.f();} int main() { GA a;show(A) ;display(A) ; GB b;show(B) ;display(B) ; return 0; }运行时的输出结果是A.1111B.1211C.1112D.1212

有如下程序:includeincludeusing namespace std;class BASE{char c;public 有如下程序: #include<iostream>#include<iosream> using namespace std; class BASE{ char c; public; BASE(char n):c(n){} virtual ~ BASE(){cout<<c;} }; class DERIVED; public BASE{ char c; public: DERIVED (char n): BASE (n+1)A.XYB.YXC.XD.Y

有如下程序:include using namespace std;Class x{protected: int a;public: x() {a= 有如下程序: #include <iostream> using namespace std; Class x { protected: int a; public: x() { a=1; } }; class x1 : virtual public x { public: x1() { a+=1; cout<<A.1B.123C.242D.244

有如下程序: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 include using namespace std;class base{private: cha 有以下程序: #include <iostream> #include <string> using namespace std; class base { private: char baseName[10]; public: base ( ) { strcpy (baseName, "Base"); } virtual char *myName() {A.DerivedBaseB.BaseBaseC.DerivedDerivedD.BaseDerived

有下列程序:includeusing namespace std;class ONE{ public:virtual void f(){COUt 有下列程序:include<iostream>using namespace std;class ONE{public:virtual void f(){COUt<<"1";}};c1assTWO:public ONE{public:TWO(){cout<<"2";}};class THREE:public TWO{pub

有以下程序:includeusing namespace std;class BASE{private: char c;public: BASE(c 有以下程序: #include <iostream> using namespace std; class BASE { private: char c; public: BASE(char n):c(n);{} virtual~BASE() { cout<<c; } }; class DERIVED:public BASE { char c; pA.XYB.YXC.XD.Y

有以下程序: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;}运行后的输出结果【 】。

有如下程序:includeusing namespace std;class B{public:Virtual void show(){cout 有如下程序: #include<iostream> using namespace std; class B{ public: Virtual void show(){cout<<“B”;} }; class D:publicB{ public: void show(){cout<<“D”;} }; void funl(B*ptr){ptr->show();} void{un2(Bref){ref.show();} voidA.BBBB.BBDC.DBBD.DBD

有如下程序: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