网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
若有如下程序: #include<iostream> usingnamespaeestd; classTestClass { public: voidwho(){cout<<"TestClass"<<endl;} }; classTestClassl:publicTestClass { public: voidwho(){cout<<"TestClassl"<<endl;}}; intmain() { TestClass*P; TestClasslobj1; p=&obj1; p->who(); retum0; } 则该程序运行后的输出结果是( )。
A.TestClassl
B.TestClass
C.0
D.无输出
参考答案
更多 “ 若有如下程序: #includeiostream usingnamespaeestd; classTestClass { public: voidwho(){cout"TestClass"endl;} }; classTestClassl:publicTestClass { public: voidwho(){cout"TestClassl"endl;}}; intmain() { TestClass*P; TestClasslobj1; p=&obj1; p-who(); retum0; } 则该程序运行后的输出结果是( )。A.TestClasslB.TestClassC.0D.无输出 ” 相关考题
考题
有如下程序: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 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
考题
有如下程序: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
考题
若有以下程序: 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:}该程序运行后的输出结果是______。
考题
有如下程序: include using namespaee std; class A{ public: A( ){cout
有如下程序:include<iostream>using namespaee std;class A{public:A( ){cout<<"A";}~A( ){cout<<"A";}};class B{A a;public:B( ){cout<<"B";}~B( )t cout<<"B";}};int main( ){B b;return 0;}程序的输出结果是______。
考题
若有如下程序:#includeiostreamusingnamespaeestd;classTestClass{public:voidwho(){coutTestClassendl;}};classTestClassl:publicTestClass{public:voidwho(){coutTestClasslendl;}};intmain(){TestClass*P;TestClasslobj1;p=&obj1;p-who();retum0;}则该程序运行后的输出结果是( )。A.TestClasslB.TestClassC.0D.无输出
考题
有如下程序: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{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.无输出
热门标签
最新试卷