更多"下面程序的运行结果是
#include<iostream.h>
"的相关试题:
[单项选择]下面程序的运行结果是
#include<iostream.h>
class base
protected:
int a;
public:
base( )cout <<"0";
;
class basel:virtual base
public:
basel ( ) cout <<"1";
;
class base2:virtual base
public:
base2( )cout <<"2";
;
class derived:public basel,public base2
public:
derived( )cout <<"3";
;
void main( )
derived obj;
cout <<end1;
A. 0123
B. 3120
C. 0312
D. 3012
[单项选择]下面程序的运行结果是 #include<iostream.h> class base{ protected: int a; public: base( ){cout <<"0";} }; class basel:virtual base{ public: basel ( ) {cout <<"1";} }; class base2:virtual base{ public: base2( ){cout <<"2";} }; class derived:public basel,public base2{ public: derived( ){cout <<"3";} }; void main( ) { derived obj; cout <<end1; }
A. 0123
B. 3120
C. 0312
D. 3012
[单项选择]下面程序的运行结果是( )。
#include<iostream.h>
class base
protected:
int a;
public:
base( )cout<<“0”;
;
Class basel:Virtual base
public:
basel( )cout<<“1”;
;
Class base2:virtual base
public:
base2( )cout<<“2”;)
;
class derived:public base1,public base2
public:
derived( )cout<<“3”;
;
void main( )
derived obj;
cout<<endl;
A. 0123
B. 3120
C. 0312
D. 3012
[单项选择]下面程序的运行结果是( )。
#include<iostream.h>
class base{
protected:
int a;
public:
base( ){cout<<"0";}
};
class basel:virtual base{
public:
basel( ){cout<<"1";}
};
class base2:virtual base{
public:
base2( ){cout<<"2";}
};
class derived:public basel,public base2{
public:
derived( ){cout<<"3";}
};
void main( )
{
derived obj;
cout<<endl;
}
A. 5
B. 3
C. 2
D. 0