网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

若有如下程序:

#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.无输出


参考答案

更多 “ 若有如下程序:#includeiostreamusingnamespaeestd;classTestClass{public:voidwho(){coutTestClassendl;}};classTestClassl:publicTestClass{public:voidwho(){coutTestClasslendl;}};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

考题 若有以下程序:include using namespace std;class Base{public: void who(){cout 若有以下程序:include <iostream>using namespace std;class Base{public:void who(){cout<<" Base"<<end1:}};class Derived1: public Base{public:void who(){ cout<<"Derived"<<end1;}};int main(){Base *p;Derived1 obj1;p=obj1;p->who();return 0;}则该程序运行后的输出结果是【 】。

考题 若有以下程序: include using namespace std; class Base { public:void who(){ cout 若有以下程序:include <iostream>using namespace std;class Base{public:void who(){cout<<"class Base"<<end1;}};class Derivedl : public Base{public:void who(){cout<<"class Derivedl"<<end1;}};class Derived2 : public Base{public:void who(){cout<<"class Derived2"<<end1;}};int main(){Base *p;Derivedl obj1;Derived2 obi2;p=obj 1;p=obj2;p->who ( );return 0;}则该程序运行后的输出结果是【 】。

考题 若有以下程序: 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: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.无输出

考题 若有如下程序: #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.无输出