有如下程序: #includediostream usingnamespacestd; classTestClass {inta; pubIic: TestClass(intx){a=x;} voidshow(){couta;)}; classTestClassl:publicTestClass {intb; public: TestClassl(inti):TestClass(i+1),b(i){} voidshow(){coutb;)}; intmain() {TestClassb(5),*P; TestClassld(1): p=&d; p-show(); return0;} 该程序运行后的打印结果是( )。A.5B.1C.0D.2

有如下程序: #included<iostream> usingnamespacestd; classTestClass {inta; pubIic: TestClass(intx){a=x;} voidshow(){cout<<a;)}; classTestClassl:publicTestClass {intb; public: TestClassl(inti):TestClass(i+1),b(i){} voidshow(){cout<<b;)}; intmain() {TestClassb(5),*P; TestClassld(1): p=&d; p->show(); return0;} 该程序运行后的打印结果是( )。

A.5

B.1

C.0

D.2


相关考题:

有如下程序: include using namespace std; class TestClass{ int k; public: TestCla 有如下程序:include<iostream>using namespace std;class TestClass{int k;public:TestClass(int x=1):k(x){}~TestClass O{cout<<k;}};int main(){TestClass a[]={TestClass(3),TestClass(3),TestClass(3)};TestClass *p=new TestClass[2];delete []p;return ():}这个程序的输出结果是______。

若有如下程序:includeusing namespace std;class TestClass{public:void who(){cout 若有如下程序: #include<iostream> using namespace std; class TestClass { public: void who(){cout<<“TestClass”<<endl;} }; class TestClassl:public TestClass { public: void who(){cout<<“TestClassl”<<endl; int main() { TestCA.TestClasslB.TestClassC.0D.无输出

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

有下列程序:include using namespace std; class TestClass1 { public: TestClass1(){ 有下列程序:include<iostream>using namespace std;class TestClass1{public:TestClass1(){cout<<"A";}};class TestClass2<public:TestClass2(){cout<<"B";}};class TestClass3:public TestClass1{TestClass2 b;

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

有如下程序:includeusing namespace std;class TestClass{protected:TestClass(){co 有如下程序: #include<iost earn> using namespace std; class TestClass{ protected: TestClass(){cout<<'x';} TestClass(char C) {cout<<c;} }; class TestClass1:public TestClass { public: TestClass1(char C) {Cout<<c;) }; int main(){ TestClass1 d1('y'); return 0; } 执行这个程序,屏幕上将显示输出( )。A.yB.yxC.xyD.yy

有如下程序: include using namespace std; class TestClass { int a 有如下程序: #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){} void show(){cout<<b;} }; int main() { TestClass b(5),*p; TestClass1 d(1); p=d; p->show(); return 0; } 该程序运行后的打印结果是( )。A.5B.1C.0D.2

有如下程序:includeusing namespace std;classTestClass{protected:TestClass(){cout 有如下程序: #include<iostream> using namespace std; classTestClass{ protected: TestClass(){cout<<'x';} TestClass(char c){cout<<c;} }; class TestClass1:public TestClass{ public: TestClass1(char C) {cout<<c;} }; int main(){ TestClass1 d1('y'); return 0; } 执行这个程序,屏幕上将显示输出( )。A.yB.yxC.xyD.yy