下列程序的输出结果为( )。 #include<iostream.h) class TestClass { public: TestClass(){val++;} static,int val; }; int TestClass::val=0; void main() { TestClass cs1; cout<<csl.val<<““; TestClass cs2; TestClass cs3,cs4; coA.03B.13C.14D.24

下列程序的输出结果为( )。 #include<iostream.h) class TestClass { public: TestClass(){val++;} static,int val; }; int TestClass::val=0; void main() { TestClass cs1; cout<<csl.val<<““; TestClass cs2; TestClass cs3,cs4; co

A.03

B.13

C.14

D.24


相关考题:

有如下程序: 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{private;char c;public;Tes 有如下程序: #include<iostream> using namespace std; class TestClass { private; char c; public; TestClass (char n):c(n){} ~TestClass () { cout<<c; } }; class TestClass1:public TestClass { Private: char c; public: TestClass1(char n):TestClass (n+1),c(n){} ~TestClass1() { cout<<c; } }; int main() { TestClass1 obj('x'); return 0; } 执行上面的程序输出( )。A.xyB.yxC.xD.y

有如下程序:includeusing namespace std;class TestClass1{public:TestClass1 (){cou 有如下程序: #include<iostream> using namespace std; class TestClass1 { public: TestClass1 (){cout<<"TestClass1";} ~TestClass1 (){cout<<"~TestClass1";} }; class TestClass2:public TestClass1 { TestClass1 *p; public: Testclass2(){cout<<"TestClass2";p=new TestClass1();} ~TestClass2(){cout<<"~TestClass2";delete p;} ); int main() { TestClass2 obj; return 0; } 执行这个程序的输出结果是( )。A.TestClass2TestClass1TestClass1~TestClass1~TestClass2~TestClass1B.TestClass1TestClass2TestClass1~TestClass2~TestClass1~TestClass1C.TestClass2TestClass1TestClass1~TestClass2~TestClass1~TestClass1D.TestClass1TestClass2TestClas1~TestClass1~TestClass2~TestClass1

执行下列程序的输出结果是______: include using namespace std; class TestClass1 { 执行下列程序的输出结果是______:include<iostream>using namespace std;class TestClass1{public:void fun1(){cout<<"TestClass1\n";}virtual void fun2(){cout<<"TestClass1\n";}};class TestClass2:public TestClass1{public:void fun1(){cout<<"TestClass2\n";}void fun2(){cout<<"TestClass2\n";}};void f(TestClass1b)<b.fun1();b.fun2();}int main(){TestClass2 obj;f(obj);return 0;}

下列程序输出结果为: include using namespace std; class TestClass1 { public: Test 下列程序输出结果为:include<iostream>using namespace std;class TestClass1{public:TestClass1(){}TestClass1(int i){x1=i;}void dispa(){cout<<"x1="<<x1<<",";}private:int x1;};class TestClass2:public TestClass1{public:TestClass2(){}TestClass2(int i):TestClass1(i+10){x2=i;}void dispb(){dispa();cout<<"x2="<<x2<<endl;}private:int x2;};int main(){TestClass2 b(2);b.dispb();return 0;}

下列程序的输出结果是()。 include using namespace std; class TestClass{ static in 下列程序的输出结果是( )。 #include<iostream> using namespace std; class TestClass{ static int i; public: TestClass(){i++;} ~TestClass(){i--;} static int getVal(){retum i;} }; int TestClass∷i=0; voiA.111B.121C.211D.221

若有如下程序:includeusing namespace std;class TestClass{public:void who() {cout 若有如下程序: #include<iostream> using namespace std; class TestClass { public: void who() {cout<<"TestClass"<<endl;} }; class TestClass1:public TestClass { public: void who(){cout<<"TestClass1"<<endl;} }; int main() { TestClass *p; TcstClass1 obj1; p=obj1; p->who(); return 0; } 则该程序运行后的输出结果是( )。A.TestClass1B.TestClassC.0D.无输出

若有以下程序:includeusing namespace std;class TestClass{public:void who(){cout 若有以下程序: #include<iostream> using namespace std; class TestClass { public: void who(){cout<<"TestClass"<<endl;} }; class TestClass1:public TestClass { public: void who(){cout<<"TestClass1"<<endl;} }; int main() { TestClass *p; TestClass1 obj1; P=obj1; P->who(); return 0; 则该程序运行后的输出结果是( )。A.TestClass1B.TestClassC.0D.无输出

下列程序的输出结果为()。includeclass TestClass{public:TestClass (){val++;}stat 下列程序的输出结果为( )。 #include<iostream.h> class TestClass { public: TestClass (){val++;} static int val; }; int TestClass::val=0; void main() { TestClass cs1; cout<<cs1.val<<""; TestClass cs2; TestClass cs3,cs4; cout<<cs2.val<<endl; }A.03B.13C.14D.24