网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
若有如下程序: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() { TestC
A.TestClassl
B.TestClass
C.0
D.无输出
参考答案
更多 “ 若有如下程序: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.无输出 ” 相关考题
考题
有如下程序: 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:int x,y;public:Te
有如下程序: #include<iostream> using namespace std; Class TestClass { private: int x,y; public: TestClass(int i,int j) { x=i; y=j; } void print() { cout<<“print1”<<endl; } void print()const { cout<<”prinA.printlB.print2C.printl print2D.程序编译时出错。
考题
有如下程序: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 namespqce Std;class TestClass{private;Char C;public;Tes
有如下程序: #include<iostream> using namespqce Std; class TestClass { private; Char C; public; TestClass(char n):c(n){} ~TestClass() { cout<<c; }; class TestClassl:public TestClass { private: Char C; public:A.xyB.yxC.xD.y
考题
若有如下程序: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;
考题
以下程序的执行结果为______。include using namespace std; class base { public: vir
以下程序的执行结果为______。include<iostream>using namespace std;class base{public:virtual void who(){cout<<"base class"<<endl;}};class derivel:public base{public:void who(){cout<<"d
考题
执行这个程序的输出结果是(); include using namespace std; class TestClass1 { publ
执行这个程序的输出结果是( );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;}
考题
有如下程序:includeusing namespace std;class TestClass{static int i;public:TestC
有如下程序: #include<iostream> using namespace std; class TestClass{ static int i; public: TestClass(){i++;} ~TestClass(){i--;} static int getVal(){return i;} }; int TestClass::i=0; void f(){TestClass obj2;cout<<obj2.getVal();} int main(){ TestClass obj 1; f(); TestClass *obj3=new TestClass;cout<<obj3->getVal(); delete obj3;cout<<TestClass::getVal(); return 0; } 程序的输出结果是( )。A.232B.221C.222D.231
考题
有如下程序: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;{TestClass(){cout
有如下程序: #include<iostream> using namespace std; { TestClass(){cout<<"BB";fun()} void fun(){cout<<"Bf";} }; class TestClass1:public TestClass { public: TestClass1(){cout<<"DD";} void fun(){cout<<"Df";} }; int main() {TestClass1 d; return 0;} 执行上面的程序将输出( )。A.BBBfDDB.BBDfDDDfC.DDD.DDBBBf
考题
下列程序中横线处正确的语句是()。includeusing namespace std;class TestClass{publi
下列程序中横线处正确的语句是( )。 #include<iostream> using namespace std; class TestClass { public: void fun(){cout<<"TestClass::fun"<<end1;} }; class TestClass1:public TestClass { void fun() { ______//显示调用基类的函数 fun() cout<<"TestClass1::fun"<<end1; } };A.fun();B.TestClass.fun()C.TestClass::fun();D.TestClass->fun();
考题
有如下程序: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
考题
有如下程序: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
考题
若有以下程序: include using namespace std; class TestClass 1 { public: TestClass
若有以下程序:include<iostream>using namespace std;class TestClass 1{public:TestClass1(){X=0;}int x;};class TestClass2:virtual public TestClass1{public:TestClass2(){x=10;}};class TestClass3:virtual public TestClass 1{public:TestClass3(){x=20;}};class TestClass4:public TestClass2, protected TestClass3{ };int main(){TestClass4 obj;cout<<obj.x<<end1;return 0:}该程序运行后的输出结果是______。
考题
有如下程序: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:virtual void fun1(
有下列程序: #include<iostream> using namespace std; class TestClass { public: virtual void fun1() { cout<<"fun1TestClass"; } virtual void fun2() { cout<<"fun2TestClass"; } }; class TeStA.fun1TeStClass1 fun2TeStClassB.fun1TestClass1 fun2TestClass1C.fun1TeStClass fun2TeStClassD.fun1TestClaSSfun2TestClaSS1
考题
有如下程序: #include(iostream) using namespace std; class TestClass{ protected: TestClass(){couti(cout<<‘x’;} TestClass(char c){cout<<c;}}; class TestClassl:publicTestClass{ public: TestClassl(char c){cout<<c;}}; int main(){ TeA.yB.yxC.xyD.yy
考题
有如下程序: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{private:int x,y;public:Te
有下列程序: #include<iostream> using namespace std; class TestClass { private: int x,y; public: TestClass (int i,int j) { x=i; y=j; } void print() { cout<<"printl"<<endl; } voA.print1B.print2C.pfint1 print2D.程序编译时出错
考题
有下列程序:includeusing namespace std;class TestClass{protected:TestClass(){cou
有下列程序: #include<iostream> using namespace std; class TestClass{ protected: TestClass(){cout<<'x';} TestClass(char c){cout<<c;} }; class TestClassl:public TestClass{ public: TestClassl(char c){cout<<c;}A.yB.yxC.xyD.yy
考题
有下列程序: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{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{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
考题
若有以下程序: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.无输出
考题
有如下程序: 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
热门标签
最新试卷