以下程序的执行结果是______. include c1ass A { public: virtual void funl () 以下程序的执行结果是______.include<iostream.h>c1ass A{public:virtual void funl () { cout<<"A fun1"<<endl;}virtual void fun2 () {cout<<"A fun2"<<endl;void fun3 () {cout<<" A fun 3 "<<endl:)void fun4 () {cout<<" A fun4 "<<endl:}
以下程序的执行结果是______. include< c1ass A { public: virtual void funl ()
以下程序的执行结果是______.
include<<iostream.h>
c1ass A
{
public:
virtual void funl () { cout<<"A fun1"<<endl;}
virtual void fun2 () {cout<<"A fun2"<<endl;
void fun3 () {cout<<" A fun 3 "<<endl:)
void fun4 () {cout<<" A fun4 "<<endl:}
相关考题:
有如下程序:#includeusing namespace std;class Base{public:void funl(){cout"Base\n";}virtual void fun2(){cout"Base\n";}};class Derived:public Base{public:void funl(){cout"Derived\n";}void fun2(){cout"Derived\n";}};void f(Base B . {b.funl();b.fun2();}, lt;, /Pint main(){Derived obj;f(obj);return 0;}执行这个程序的输出结果是A . Base BaseB . Base DerivedC . Derived BaseD . Derived Derived
有如下程序: include using namespaee std; class ONE{ public: virtual void f 有如下程序:include <iostream>using namespaee std;class ONE{public:virtual void f( ){cout<<"1";}};class TWO:public ONE{public:TWO( )1 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: virmal 以下程序的执行结果是【 】。include<iostream>using namespace std;class base{public:virmal void who(){cout<<"Base Class"<<endl;)};class Derivedl:public Base{public:virtual void who(){cout<<"Derivedl Class"<<endl;}};class derived2:public Base{public:virtual void who(){cout<<"Derived2 Class"<<endl;)};int main(int argc,char*argv[]){base obj1,*P;deliVedl obj2;derived2 obj3;p=obj1; p->who();p=obj2; p->who();p=obj3; p->who();return 0;}
有如下程序: 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;}执行上面程序的输出是______。
下面程序的运行结果是 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
有如下程序: include using namespace std; class B { public: 有如下程序: #include <iostream> using namespace std; class B { public: virtual void show() { cout<<"B"; } }; class D: public B{ public: void show() { cout<<"D"; } }; void fun1(B *ptr) { ptr->show();} void fun2(B ref) { ref. show();} void fun3(B b) {b.show();} int main() { B b,*p=new D; D d; fun1(p); fun2(b); fun3(d); return 0; }程序的输出结果是A.BBBB.BBDC.DBBD.DBD
有如下程序: 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 namespacc std; class A { public:void sho 下面程序输出的结果是【 】。include <iostream>using namespacc std;class A {public:void show(){tout<<"A!";}};class B: public A{public:virtual void show(){cout<<"B!";}};class C: public B{public:virtual 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 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 TestClass1 { publ 执行这个程序的输出结果是( );include<iostream>using namespace std;class TestClass1{public:void fun1(){cout<<"TestClass1\n";}virtual void fun2(){cout<<"TestClass1\n";}};class TestClass2:public TestClass1{public:void fun1(){cout<<"TestClass2\n";}void fun2(){cout<<"TestClass2\n";}};void f(TestClass1b){b.fun1();b.fun2();}int main(){TestClass2 obj;f(obj);return 0;}
下面程序的结果是includeclass A{public: A(){cout 下面程序的结果是 #include<iostream.h> class A { public: A(){cout<<"construtA" <<endl;} virtual ~A() {cout << "destructA" <<endl;}}; class B:public A { }; class C:public A { }; class D:public B,public C { }; void main() { Dd;}A.constructAB.constructAC.constmctAD.constmctA destructA constructA constmctA constructA destructA constructA constructA destructA destructA constructA destructA dest
下列程序的运行结果是______。 include class A { public: virtual void use( ) {cou 下列程序的运行结果是______。include<iostream.h>class A{public:virtual void use( ) {cout<<"in A\n";}};class B:public A{public:virtual void use( ) {cout<<"in B\n";}};class C:public B{public:virtual void use( ){cout"in C\n";}};void main( ){A*obj;bj=new C;obj->use( );delete obj;}
有如下程序: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:public B{ public: void show( ){cout<<"D";} }; void funl(B*ptr){ptr->show( );} void fun2(Bref);ref.show( );} void fun3(B b){b.show( );} int nlain( ){ B b,*P=Dew D; D d; funl(p); fun2(b); fun3(d); return 0; } 程序的输出结果是A.BBBB.BBDC.DBBD.DBD
下面程序的输出结果是includeclass A{public: A( ) {cout 下面程序的输出结果是 #include<iostream.h> class A { public: A( ) {cout < < "construtA" < < endl;} Virtual~A( ) {cout < < "destructA" < < endl;}}; class B: public A { }; class C:public A { }; class D:public B,public C { }; void main( ) { D d;}A.constructAB.constructAC.constructAD.constructA destructA constructA constructA constructA destructA constructA constrnctA destructA destructA constructA destructA destructA destructA destrctA destructA destructA
下列程序的运行结果是______。include class Base { public: void f(int x){cout 下列程序的运行结果是______。include<iostream.h>class Base{public:void f(int x){cout<<“Base:”<<x<<endl;});class Derived:public Base{public:void f(char*str){cout<<“Derived:”<<str<<endl;}};void main(void){Base*pd=ne
以下程序的执行结果是______。 include class A{ int a: public: void seta(int x) { 以下程序的执行结果是______。include<iostream.h>class A{int a:public:void seta(int x) {a=x;}void showa() {cout<<a<<end1;}};class B{int b;public:void setb(int x) {b=x;}void showb(){cout<<b<<end1;}};
以下程序的执行结果是______。 include class base { public: virtual void who(){c 以下程序的执行结果是______。include<iostream.h>class base{public:virtual void who(){cout<<"base class"<<endl:}};class derrvel:public base{public:void who(){cout<<"derivel class"<<endl:}};class derive2;public base{public:void who() {cout<<"derive2 class"<<endl;}};void main(){base obj1,*P;derive1 obj2;derive2 obj3:p=obj1;p->who();p=obj2:p->who();p=obj3;p->who();}
有如下程序: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
有如下程序: #includeiostream using namespace std; class Base { public: void funl{cout”Base\n”;} virtual void fun2{eout”Base\n”;} }; class Derived:public Base{ public: void funl{eout”Derived、n”;} void fura{eout.”Derived\n”;} }; void f(BaseB.}b.funl;b.ftm2;} int main { Derived obj; f(obj); return 0; } 执行这个程序的输出结果是( )。A.Base BaseB.Base DerivedC.Derived BaseD.Derived Derived
有如下程序: #inCludeiostream using namespaCe std; Class B{ publiC: virtual void show{Cout”B”;} }; Class D:publiC B{ . publiC: void show{Cout”D”;} }; void funl(B * ptr){ptr一show;} void fUN2(Bref){ref.show;} voidfhIl3(B B.{b.show;} int main { B b,* P=new D; D d; funl(P); fun2(B.; fun3(D); delete P; return 0; } 执行这个程序的输出结果是( )。A.BBBB.BBDC.DBBD.DBD
以下程序执行结果是 ( )。include class Base{public virtual void fun() {cout 以下程序执行结果是 ( )。 #include <iostream.h> class Base { public virtual void fun() { cout<<"B"; } }; class Derived { public: Derived() { cout<<"D"; } virtual void fun(){ Base::fun(); cout<<"C"; } } int main () { Base *ptr; Derived obj; ptr=obj; p->fun ( ); return 0; }A.DBCB.DCBC.BDCD.CBD
下面程序输出的结果是【 】。 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;}执行后的输出结果为【 】。
有如下程序:includeusing namespace std;class TestClass{public:virtual void fun1( 有如下程序: #include<iostream> using namespace std; class TestClass { public: virtual void fun1() { cout<<"fun1TestClass"; } virtual void fun2() { cout<<"fun2TestClass"; } }; class TestClass1:public TestClass { void fun() { cout<<"fun1TestClass1"; } void fun2(int x) { cout<<"fun2TestClass1"; } }; int main() { TestClass obj1,*p; TestClass1 obj2; p=obj2; p->fun1(); p->fun2(); return 0; } 该程序执行后的输出结果是( )。A.fun1TestClass1 fun2TestClassB.fun1TestClass1 fun2TestClass1C.fun1TestClass fun2TestClassD.fun1TestClass fun2TestClass1
有如下程序: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 class Basel{public: void fun(){ cout 以下程序执行后的输出结果是 ( )。 #include <iostream.h> class Basel { public: void fun(){ cout<<"Basel"<<end1; } }; class Base2 { public: void fun() { cout<<"Base2"<<end1; } } class Derived : public Basel,public Base2 { }; void main() { Derived Obj; Obj.fun(); }A.BaselB.Base2C.BaselBase2D.程序产生二义性
下列程序的运行结果是______。 include class Base { public: virtual void func(int 下列程序的运行结果是______。include<iostream.h>class Base{public:virtual void func(int i){cout<<"class Base:"<<i<<end1;)};class Derived: public Base{public:void func(double d){cout<<"class Derived:"<<d<<endl;}};void main( ){Base a,*p=a;Derived b;p=b;(*p).func(3.3);}