执行这个程序的输出结果是(); 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;}
执行这个程序的输出结果是(); 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(TestClass1&b){b.fun1();b.fun2();}
int main()
{
TestClass2 obj;
f(obj);
return 0;
}
相关考题:
如下程序的输出结果是______。 include using namespace std; class pumpkin{ publ 如下程序的输出结果是______。include<iostream>using namespace std;class pumpkin{public:pumpkin( ){++count;}~pumpkin( ){--eount;}static void total_count( ){cout<<count<<"pumpkin(s)"<<endl;}private:static int count;};int pumpkin::count=0;int main( ){pumpkin pl[10];pumpkin::total_count( );return 0;}
有以下程序 include int i=0; void fun( ) { { static int i=1 有以下程序 #include<iostream> int i=0; void fun( ) { { static int i=1; Std::cout<<i++<<','; } Std::cout<<i<<','; } int main( ) { fun();fun(); return O; } 程序执行后的输出结果是A.1,2,1,2,B.1,2,2,3,C.2,0,3,0,D.1,0,2,0,
有以下程序includeint i=0;void fun(){{ Static int i=1 Std::cont 有以下程序 #include<iostream,h> int i=0; void fun() { { Static int i=1 Std::cont<<i++<<','; } Std::cout<<i<<','; } int main() { fun();fun(); return 0; } 程序执行后的输出结果是( )。A.1,2,1,2,B.1,2,2,3,C.2,0,3,0,D.1,0,2,0,
有以下程序: include int i=0;void fun(){{static iht i=1; std::cout 有以下程序: # include <iostream> int i=0; void fun() {{static iht i=1; std::cout<<i++<<','; } std:: cout<<i<<','; } int main() { fun(); fun(); return 0; }程序执行后的输出结果是______。A.1,2,1,2,B.1,2,2,3,C.2,0,3,0,D.1,0,2,0,
如下程序的输出结果是includevoid fun(int x=y;y=t;}int main(){in 如下程序的输出结果是 #include<iostream> void fun(int & X,inty){intt=x;x=y;y=t;} int main( ){ int a[2]={23,42}; fun(a[1],a[0]); std::cout<<a[0]<<","<<a[1]<<std::endl; return 0; }A.42,42B.23,23C.23,42D.42,23
有如下程序: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
执行下列程序的输出结果是______: include using namespace std; class TestClass1 { 执行下列程序的输出结果是______: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;}
有以下程序include int i = 0;void fun( ){ {static int i = 1;std::cout 有以下程序 #include <iostream> int i = 0; void fun( ) { { static int i = 1; std::cout<<i++<<','; } std::cout<<i<<','; } int main() { fun(); fun(); return 0; } 程序执行后的输出结果是A.1,2,1,2,B.1,2,2,3,C.2,0,3,0,D.1,0,2,0,
有如下程序: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