单项选择题
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
有如下程序: #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.y
B.yx
C.xy
D.yy
点击查看答案&解析
单项选择题
下列程序的输出结果是( )。 #include<iostream> using namespace std; class TestClass{ static int i; public: TestClass(){i++;} ~TestClass(){i--;} static int getVal(){return i;} }; int TestClass::i=O; void fun(){TestClass ob2;cout<<ob2.getVal();} int main(){ TestClass ob1; fun(); TestClass*ob3=new TestClass;cout<<ob3->getVal(); delete ob3;cout<<TestClass::getVal(); return 0; }
A.111
B.121
C.211
D.221
点击查看答案&解析
相关试题
有如下程序: #include<iostream> Usi...
有如下程序: #include<iostream> usi...
有如下程序: #include<iostream> usi...
有如下程序: #include<iostream> usi...