有如下程序: #include <iostream.h> class x { protected: int a; public: x() { a=1; } }; class x1 : virtual public x { public: x1() { a+=1; cout<<a; } }; class x2 : virtual public x { public: x2() { a+=2; cout<<a; } }; class y : public xl,public x2 { public: y() { cout<<a<<end1; } }; int main() { y obj; return O; } 该程序运行后的输出结果是( )。
A.1
B.123
C.242
D.244
[单选题]有如下程序:include usingnamespacestd:class Test{public: Test(){n£«=2; ~Test(){n£有如下程序:#include <iostream>using namespace std:class Test{public: Test() {n+=2; ~Test() {n-=3; ; static int getNum() {return n;}privaue: static int n:};int Test::n=1;int main()
[单选题]有如下程序:include using namespace std;class BASE{public:~BASE(){cout<<"BASE";}有如下程序: #include <iostream> using namespace std; class BASE{ public: ~BASE(){cout<<"BASE";} }; class DERIVED:public BASE{ public: ~DERIVED(){cout<<"DERIVED";} }; int main(
[单选题]有如下程序:include using namespace std;class Base{public:Base(){ cout<<"BB";有如下程序: #include <iostream.h> using namespace std; class Base { public: Base(){ cout<<"BB"; f(); } voidf(){cout <<"Bf"; } }; class Derived: public Base { public: Derived (){c
[单选题]有如下程序: include using namespaee std;class Animal{ public: virtual char*g有如下程序:include<iostream>using namespaee std;c lass Animal{public:virtual char*getType( )const{return"Animal";}virtual char*getVoice( )const{return"Voice";}};class Dog:public An
[单选题]有如下程序:include using namespace std;class point{intx,y;public:point( int vx,有如下程序:#include <iostream>using namespace std;class point{ int x, y;public: point( int vx, int vy ) { x = vx; y = vy; } point ( ) x = 0; y= 0; } point operator+( point p1 ) { po
[单选题]有如下程序;include using namespace std;class Base{public;Base(inti){x=i;}void d有如下程序; #include <iostream> using namespace std; class Base { public; Base(inti){x=i;} void dispa0{cout<<x<<',';} private; int x; }; class Derived;public Base { public; Derive
[单选题]有如下程序:include using namespace std;class A {public: A() {cout<<"A";}};class有如下程序: #include <iostream> using namespace std; class A { public: A() {cout<<"A";} }; class B {public:B() {cout<<"B";}}; class C: public A { Bb; public: C() {cout<<"C";
[单选题]有如下程序:include using namespace std;class Stack {public: Stack(unsigned n= 1有如下程序: #include <iostream> using namespace std; class Stack { public: Stack(unsigned n= 10):size(n) {rep_=ew int[size]; top=0;} Stack(Stack& s):size(s.size) { rep_=new int[
[单选题]有如下程序:include using namespace std;class x{protected: int a;public: x() { a有如下程序: #include <iostream> using namespace std; class x { protected: int a; public: x() { a=1; } }; class x1 : virtual public x { public: x1() { a+=1; cout<<a; } };A.1B.123C.24
[单选题]有如下程序:include using namespace std;Class x{protected: int a;public: x() {a=有如下程序: #include <iostream> using namespace std; Class x { protected: int a; public: x() { a=1; } }; class x1 : virtual public x { public: x1() { a+=1; cout<<A.1B.123C.242D.244