下面这个程序的结果是 #include<iostream.h> class A { private: int a; public: void seta();int geta();}; void A∷seta() {a=1;} int A∷geta() {return a;} class B { pnvate: int a; publiC: void sera();int geta();}; void B∷seta() {a = 2;} int B∷geta() {return a;} class C:public A,public B { private: int b; public: void display();}; void C∷display() { int b=geta(); cout<<b;} void main() { C c; c.seta(); c.display();}
A.1
B.2
C.随机输出1或2
D.程序有错
第1题:
下面这个程序的结果是
#include<iostream.h>
class A
{
private:
int a;
public:
void seta( ) ;int geta( ) ;};
void A: :seta( )
{ a=1;}
int A: :geta( )
{ retum a;}
class B
{ private:
int a;
public:
void seta( ) ;int geta( ) ;};
void B: :seta( )
{a=2;}
int B: :geta( )
{return a;}
class C: public A,public B
{ private:
int b;
public:
void display( ) ;};
void C: :display( )
{ int b=geta( ) ;
cout < < b;}
void main( )
{ C c;
c. seta( ) ;
c. display( ) ;}
A.1
B.2
C.随机输出1或2
D.程序有错
第2题:
下面这个程序的结果是 #include<iostream.h> class A { private: int a; public: void seta( );int geta( );}; void A::seta( ) { a = 1;} int A::geta( ) {return a;} class
A.1
B.2
C.随机输出1或2
D.程序有错
第3题:
第4题:
下列程序的运行结果是 #include<iostream.h> class Location{ private: int X.Y; public: void init(int=0,int=0); void valueX(int val){X=val;} int valueX( ){ return X;} void valueY
A.5 0 6 4
B.0 0 6 4
C.5 0 6 2
D.0 0 6 2
第5题: