下面程序的结果是 #include<iostream.h> class A { int a; public: A( ) :a(1) {} void showa ( ) {cout < < a;} }; class B { int a; public: B( ) :a(2) {} void showa( ) {cout < < a;} }; class C: public A, public B { t a; public: C( ) :a(3) {} void showa( ) {cout < < a;} }; void main( ) { C c; c.showa( ) ; }
A.1
B.2
C.3
D.程序有错误
第1题:
下列程序的运行结果是______。
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
第2题:
下面程序的结果是 #include<iostream.h> class A { int a; public: A():a(1){} void showa(){cout<<a;} }; class B { int a; public: B():a(2){} void showa(){cout<<a;} }; class C:public A,public B { int a; public: C():a(3) ㈠ voidshowa(){cout<<a;} }; voidmain() { C c; c.showa(); }
A.1
B.2
C.3
D.程序有错误
第3题:
下面程序的结果是( )。 #include<iostream.h> class A { int a; public: A():a(1){} void showa(){cout<<a;} }; Class B { int a; public: B():a(2){} void showa(){cout<<a;} ); class C:public A,public B { int a; pu
A.1
B.2
C.3
D.程序有错误
第4题:
下面程序的运行结果是 #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.123
B.3120
C.312
D.3012
第5题:
下面程序的结果是 #include<iostream.h> class A { int a; public: A( ):a(1){} void showa( ){cout<<a;} }; class B { int a; public: B( ) :a(2) {}
A.1
B.2
C.3
D.程序有错误