更多"分析下面程序,该程序的运行结果是( )。 #include<ios"的相关试题:
[单项选择]分析下面程序,该程序的运行结果是( )。
#include<iostream.h>
class cmm
public:
static int m;
cmm( )
m++;
cmm(int n)
m=n;
static void testm( )
m++;
;
int cmm :: m=0;
void main( )
cmm A;
cmm B(3);
A. testm();
B. m=3
C. m=4
D. m=5
E. m=6
[单项选择]下面程序的运行结果是
#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. 0123
B. 3120
C. 0312
D. 3012
[单项选择]下面程序的运行结果是
#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) 0123 B) 3120 C) 0312 D) 3012
[单项选择]下面程序的结果是
#include
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){}
void showa( ){cout<<a;}
};
void main( )
{
C c;
c.showa( );
}
A. 1
B. 2
C. 3
D. 程序有错误
[单项选择]下面程序的运行结果是 #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<<endl;
}
A. 123
B. 3120
C. 312
D. 3012