下面程序的运行结果是 #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
第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> classbase{ protected: inta; public: base(){cout<<"0";} }; classbasel:virtualbase{ public: basel(){cout<<"1";} }; classbase2:virtualbase{ public: base2(){cout<<"2";} }; classderived:publicbasel,publicbase2{ public: derived(){cout<<"3";} }; voidmain() { derivedobj; eout<<endl: }
A.0123
B.3120
C.O312
D.3012
第3题:
下面程序的运行结果是 #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.123
B.3120
C.312
D.3012
第4题:
下面程序的输出结果是【 】。
include <iostream>
using namespace std;
class base
{
protected:
int a;
public:
base(){cout<<"0":}
};
class basel: virtual public base
{
public:
base1(){ cout<<"1";}
};
class base2 : virtual public base
{
public:
base2(){cout<<"2";}
};
class derived : public base1,public base2
{
public:
derived () {cout<<"3"; }
}
int main ()
{
derived obj;
cout<<end1;
return 0;
}
第5题:
下面程序的运行结果是( )。 #include<iostream.h> class base{ protected: int a; public: base{cout<<”0”;} }; class basel:virtual base{ public: basel{cout<<”1”;} }; class base2:virtual base i 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