网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

有如下程序: #include<iostream> usingnamespacestd; classXA{ inta; public: staticintb; XA(intaa):a(aa){b++;} ~XA( ){} intget( ){returna;} }; intXA::b=0 intmain( ){ XAd1(1),d2(3); cout<<d1.get( )+d2.get( )+XA::b<<endl; return0; } 运行时的输出结果是( )。

A.5

B.6

C.7

D.8


参考答案

更多 “ 有如下程序: #includeiostream usingnamespacestd; classXA{ inta; public: staticintb; XA(intaa):a(aa){b++;} ~XA( ){} intget( ){returna;} }; intXA::b=0 intmain( ){ XAd1(1),d2(3); coutd1.get( )+d2.get( )+XA::bendl; return0; } 运行时的输出结果是( )。A.5B.6C.7D.8 ” 相关考题
考题 有如下程序:includeusing namespace std;class A{public:static int a;void init(){a 有如下程序: #include<iostream> using namespace std; class A{ public: static int a; void init(){a=1;} A(int a=2){init(); a++;} }; int A::a=0; A obj; int main() { cout<<obj.a; return 0; 运行时输出的结果是( )。A.0B.1C.2D.3

考题 有以下程序:includeusing namespace std;class A{private:int a;public:A(int i){a=i 有以下程序: #include<iostream> using namespace std; class A {private: int a; public: A(int i) {a=i;} void disp() {cout<<a<<“,”;}}; class B {private: int b; public: B(int j) {b=j;} void disp() {cout<<b<<“,”;A.10,10,10B.10,12,14C.8,10,12D.8,12,10

考题 若有如下程序:includeusing namespace std;Class TestClass1{private:int a;public:T 若有如下程序: #include<iostream> using namespace std; Class TestClass1 { private: int a; public: TestClassl(int i) { a=i; } void disp() { cout<<a<<“,”; } }; Class TestClass2 { private: int b; publicA.10,10,10B.10,12,14C.8,10,12D.8,12,10

考题 有如下程序:includeusing namespace std;class A{public: static int a; void init 有如下程序:#include<iostream>using namespace std;class A{public: static int a; void init(){a=1;} A(int a=2){init();a++;}};int A::a=0;A obj;int main(){ cout<<obj.a; return 0;}运行时输出的结果是A.0B.1C.2D.3

考题 有如下程序:includeusing namespace std;class test{private: int a;public: test( 有如下程序:#include<iostream>using namespace std;class test{private: int a;public: test(){cout<<"constructor"<<endl;} test(int a){cout<<a<<endl;} test(const test_test) { a=_test.a; cout<<"copy constructor"<<en+dl; } ~test(){cout<<"destructor"<<endl;}};int main(){ test A(3); rerun 0;}运行时输出的结果是A.3B.constructor destructorC.copy constructor destructorD.3 destructor

考题 有如下程序: include using namespace std; class XA{ int a; public: static int b; 有如下程序:#include<iostream>using namespace std;class XA{int a;public:static int b;XA(int aA) : a(aA) {b++;}~XA(){}int get(){return a;}};int XA::b=0;int main(){XA d1(2), d2(3);cout<<d1. get()+d2. get()+XA::b<<end1;return 0;}运行时的输出结果是( )。A) 5B) 6C) 7D) 8A.B.C.D.

考题 有如下程序: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

考题 有如下程序:includeusing namespace std;Class TestClass{int a;public:TestClass(in 有如下程序: #include<iostream> using namespace std; Class TestClass {int a; public: TestClass(int x){a=x;} void show(){cout<<a;}}; class TestClass1:public TestClass {int b; public: TestClass1(int i):TestClass(i+1),b(i){} voiA.5B.1C.0D.2

考题 有下列程序:includeusing namespace std;class TestClass{int a;public:TestClass(in 有下列程序: #include<iostream> using namespace std; class TestClass { int a; public: TestClass(int x)<a=x;} void show(){cout<<a;} }; class TestClass1:publicTestClass { int b; public: TestClaA.5B.1C.0D.2

考题 有如下程序: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.242D.244