若有如下程序: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; TcstClass1 obj1; p=&obj1; p->who(); return 0; } 则该程序运行后的输出结果是( )。
A.TestClass1
B.TestClass
C.0
D.无输出
相关考题:
有如下程序: 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 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;{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
有如下程序: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(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{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.无输出