网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
类定义如下: class TestClass { public: TestClass (){cout<<1;} }; 则执行语句TestClass a,b[2] ,*p[2];后,程序的输出结果是( )。
A.11
B.111
C.1111
D.11111
参考答案
更多 “ 类定义如下: class TestClass { public: TestClass (){cout<<1;} }; 则执行语句TestClass a,b[2] ,*p[2];后,程序的输出结果是( )。A.11B.111C.1111D.11111 ” 相关考题
考题
有如下程序: 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:virtUal void furll
有如下程序: #inClude<iostream> using namespace std; Class TestClass {public: virtUal void furll() {cout<<“funlTestclass”;} virtual void fun2() {cout<<“{fun2TestClass”;}}; class TestClassl:public TestClass {void fun() {cout<<“fuA.fun1TestClass1 fun2TestClassB.fun1TestClass1 fun2TestClass1C.fUnlTestClass fun2TestClassD.funlTe3tClass fun2TestClassl
考题
有如下程序: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:virtual void fun(
有如下程序: #include<iostream> using namespace std; class TestClass1 { public: virtual void fun(){cout<<"1";} }; class TestClass2: public TestClass1 { public: TestClass2(){cout<<"2";} }; class TestClass3:public TestClass2 { public: virtual void fun(){TestClass2::fun();cout<<"3";} }; int main() { TestClass 1 aa,*p; TestClass2 bb; TestClass3 cc; p=cc; P->fun(); return 0; } 执行上面程序的输出是( )。A.1122B.2112C.2213D.2223
考题
有如下程序: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
考题
有如下程序:includeusing namespace std;class TestClass{public:TestClass(){cout
有如下程序: #include<iostream> using namespace std; class TestClass { public: TestClass(){cout<<"default constructor\n";} TestClass(const TestClass x){cout<<"copy constructor\n";} }; TestClass userCode(TestClass b){TestClass c(b);return c;} int main() { TestClass a,d; cout<<"calling userCode()\a"; d=userCode(a); return 0; } 在执行过程中,构造函数TestClass()和TestClass(const TestClass x)被调用的次数分别是( )。A.1和1B.1和2C.2和3D.2和4
考题
有如下程序:includeincludeusing namespace std;class TestClass{public;T
有如下程序: #include<iostream> #include<iomanip> using namespace std; class TestClass{ public; TestClass (){cout<<'A';} TestClass(char C){cout<<c;) ~TestClass (){cout<<'B';} }; int main(){ TestClass p1,*p2; p2=new TestClass('X'); delete p2; return 0; } 执行这个程序的结果是( )。A.ABXB.ABXBC.AXBBD.AXB
考题
有如下程序:includeusing namespace std;class TestClass{public:virtual void fun1(
有如下程序: #include<iostream> using namespace std; class TestClass { public: virtual void fun1() { cout<<"fun1TestClass"; } virtual void fun2() { cout<<"fun2TestClass"; } }; class TestClass1:public TestClass { void fun() { cout<<"fun1TestClass1"; } void fun2(int x) { cout<<"fun2TestClass1"; } }; int main() { TestClass obj1,*p; TestClass1 obj2; p=obj2; p->fun1(); p->fun2(); return 0; } 该程序执行后的输出结果是( )。A.fun1TestClass1 fun2TestClassB.fun1TestClass1 fun2TestClass1C.fun1TestClass fun2TestClassD.fun1TestClass fun2TestClass1
考题
若有如下程序: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.无输出
热门标签
最新试卷