有如下程序: #includeiostream using namespace std; classBase{ public: void fun{ __________________ cout”Base::fun”endl;} }; class Derived:public Base{ public: voidfun{ cout”Derived::fun”endl: } }; int main{ Derived d; A fun; return 0; } 已知其执行后的输出结果为: Base::fun Derived::fun 则程序中下画线处应填入的语句是( )。A. Base.fun;B.Base::fun;C.Base—fun;D.fun;
有如下程序: #include<iostream> using namespace std; classBase{ public: void fun{ __________________ cout<<”Base::fun”<<endl;} }; class Derived:public Base{ public: voidfun{ cout<<”Derived::fun”<<endl: } }; int main{ Derived d; A fun; return 0; } 已知其执行后的输出结果为: Base::fun Derived::fun 则程序中下画线处应填入的语句是( )。
A. Base.fun;
B.Base::fun;
C.Base—>fun;
D.fun;
相关考题:
有如下程序:#include +using namespace std ;#includeusing namespace std;class Base{public:void fun(){cout"Base::fun"};class Derived:public Base{public:void fun(){cout"Derived::fun"}};int main(){Derived d;d.fun();return 0;}已知其执行后的输出结果为:Base::funDerived::fun则程序中下划线处应填入的语句是A . Base.fun();B . Base::fun()C . Base-fun()D . fun();
下列程序中划线处正确的语句是()。 include using namespace std;class Base{public:v 下列程序中划线处正确的语句是( )。 # include <iostream> using namespace std; class Base { public: void fun(){cout<<"Base:: fun" <<endl;} }; class Derived:public Base { void fun() { ______ ∥显式调用基类的函数fun() cout<<"DA.fun();B.Base.fun();C.Base::fun();D.Base- >fun();
有如下程序: include using namespace std; class B { public: 有如下程序: #include <iostream> using namespace std; class B { public: virtual void show() { cout<<"B"; } }; class D: public B{ public: void show() { cout<<"D"; } }; void fun1(B *ptr) { ptr->show();} void fun2(B ref) { ref. show();} void fun3(B b) {b.show();} int main() { B b,*p=new D; D d; fun1(p); fun2(b); fun3(d); return 0; }程序的输出结果是A.BBBB.BBDC.DBBD.DBD
有如下程序: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 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.无输出
下列程序的输出结果为2,请将程序补充完整。 inelude using namespace std; class Bas 下列程序的输出结果为2,请将程序补充完整。inelude<iostream.h>using namespace std;class Base{public:______ void fun( ){cout<<1;}};class Derived: public Base{pbulic:void fubn( ){cout<<2;}};int main( ){Base*P=new Derived;P→fun( );delete P;return 0;}
请在下列程序中的横线处填写正确的语句。include using namespace std; class Base{ pu 请在下列程序中的横线处填写正确的语句。include<iostream>using namespace std;class Base{public:void fun(){cout<<“Basefun”<<endl;});class Derivde:public Base{public:void fun(){//调用基类的函数fun()cout<<“Derived fun”<<endl;}};
有如下程序:includeusing namespace std;class B{public:virtual void show( ){cout 有如下程序: #include<iostream> using namespace std; class B{ public: virtual void show( ){cout<<"B";} }; class D:public B{ public: void show( ){cout<<"D";} }; void funl(B*ptr){ptr->show( );} void fun2(Bref);ref.show( );} void fun3(B b){b.show( );} int nlain( ){ B b,*P=Dew D; D d; funl(p); fun2(b); fun3(d); return 0; } 程序的输出结果是A.BBBB.BBDC.DBBD.DBD
下列程序的输出结果为2,请将程序补充完整。 include using namespace std; class Basc 下列程序的输出结果为2,请将程序补充完整。include<iostream>using namespace std;class Basc{public:【 】void fun(){cout<<1;}};class Dcrived:public Base{public:void fun(){cout<<2;}};int main(){Base*p=new Derived;p->fun();delete p;return 0;}
有如下程序:include using namespace std;class Base{ public: void fun() { cout 有如下程序: #include <iostream> using namespace std; class Base { public: void fun() { cout<<"Base::fun"<<endl; } }; class Derived : public Base { public: void fun() { ______ cout<<"Derived::fun"<<endl; } }; int main() { Derived d; d.fun(); return 0; } 已知其执行后的输出结果为: Base::fun Derived::fun 则程序中下划线处应填入的语句是( )。A.Base.fun();B.Base::fun();C.Base->fun();D.fun();
有如下程序: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 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
在下列程序画线处填入的正确语句是()。includeusing namespace std;classBase{public: 在下列程序画线处填入的正确语句是( )。 #include <iostream> using namespace std; class Base { public: void fun() { cout<<"Base::fun",<<end1; } }; class Derived:public Base { void fun() { ______________ //显式调A.fun();B.Base.fun();C.Base::fun();D.Base->fun();
在下面程序中,括号里应填()。 include using namespace std; class A { public: void 在下面程序中,括号里应填( )。 #include <iostream> using namespace std; class A { public: void fun( ) { cout << "Hello" << endl; } }; class B:: public A { void fun( ) { ( ) //调用基类的函数fun( ) tout << "HI" << endl; } };A.fun()B.A. fun()C.A::fun()D.A-fun(
执行如下程序将输出():includeusing namespace std;class Base{public:Base(){cout 执行如下程序将输出( ): #include<iostream> using namespace std; class Base { public: Base(){cout<<"BB";fun();} void fun (){tout<<"Brim";} }; class Derived:public Base { public: Derived(){cout<<"DD";} void fun (){cout<<"Dfun";} }; int main(){Derived d;return 0;}A.DDB.BBDfunDDDfunC.BBBfunDDD.DDBBBfun
下列程序的输出结果为2,请将程序补充完整。 include using namespace std; class Base 下列程序的输出结果为2,请将程序补充完整。include<iostream>using namespace std;class Base{public:______void fun(){cout<<1;}};class Derived:public Base{public:void fun(){cout<<2;}};int main(){Base*p=new Derived;p->fur();delete p;return 0;}
有如下程序:include using namespace std;class Base{public:void fun() {cout 有如下程序:#include <iostream>using namespace std;class Base { public: void fun() {cout<<"Base:: fun"<<end1; }};class Derived: public Base ( public: void fun() { ____________________________ cout<<"Derived:: fun"<<end1; }};int main() { Derived d; D. fun(); return O;}已知其执行后的输出结果为:Base:: funDerived:: fun则程序中下划线处应填入的语句是( )。A.Base. fun ();B.Base:: fun ();C.Base->fun();D.fun()
将下面程序补充完整。 include using namespace std; class Base{ public: 【 】fun(){r 将下面程序补充完整。include <iostream>using namespace std;class Base{public:【 】 fun(){return 0;} //声明虚函数};class Derived:public Base{public:x,y;void SetVal(int a,int b){}int fun(){return x+y;}};void 【 】 SetVal(int a,int b){x=a;y=b;} //类Derived成员函数void main(){Derived d;cout<<d.fun()<<endl;}
有如下程序:include using namespace std;class AA{public: virtual void f() {cout 有如下程序: #include <iostream> using namespace std; class AA { public: virtual void f() { cout<< "AA"; } }; class BB : public AA { public: BB() { cout << "BB"; } }; claA.AAB.AABBCCC.BBAABBCCD.BBBBAACC
有如下程序: include using namespace std; class Base { public: 有如下程序: #include<iostream> using namespace std; class Base { public: void fun() { cout<<"Base::fun"<<endl; } }; class Derived: public Base { public: void tim() } ____________ cout<<"Derived:: fun"<<endl; } }; int main() { Derived d; d.fun(); return O; } 已知其执行后的输出结果为: Base::fun Derived::fun 则程序中下划线处应填入的语句是A.Base.fun();B.Base::fun();C.Base->fun();D.fun();
有如下程序: include using namespace std; class Base { private: 有如下程序: #include<iostream> using namespace std; class Base { private: void funl()const {cout<<"funl";} protected: void fun2() const{cout<<"fun2";} public; void fun3() const {cout<<"fun3";} }; class Derived:protected Base { public; void fun4() const {cout<<"fun4";} }; int main() { Derived obj; obj.funl(); //① obj.fun2(); //② obj.fun3(); //③ obj.fun4(): //④ return 0; } 其中有语法错误的语句是A.①②③④B.①②③C.②③④D.①④
有下列程序: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 using namespace std; classBase { protected: int i; public 有下列程序: #include<iostream.h> using namespace std; classBase { protected: int i; public: int j; }; classDerived:public Base { int m; public: intn; }; intA.[1]和[2]B.[1)和[3]C.[2]和[3]D.[2]和[4]
有如下程序:nclude using namespace std;class Base{public:void fun1() {cout 有如下程序:#nclude <iostream>using namespace std;class Base{ public:void fun1() {cout << "Base\n"; }virtual void fun2() {cout << "Base\n"; }};class Derived: public Base{ public:void fun1() {cout << "Derived\n"; }void fun2() {cout << "Derived\n"; }} void f(Base b) { B. fun1(); B. fun2(); }int main(){Derived obj;f(obj);return 0;}A.Base BaseB.Base DerivedC.Derived BaseD.Derived Derived
下列程序中划线处正确的语句是()。include using namespace std;class Base{public:vo 下列程序中划线处正确的语句是( )。#include <iostream>using namespace std;class Base{public:void fun() { cout<<"Base:: fun"<<end1; }};class Derived: public Base{ void fun() { _______________________ //显试调用基类的函数 fun() cout <<"Derived:: fun"<<end1;};A.fun();B.Base. fun();C.Base:: fun();D.Base->fun();
请在如下程序中的空格处填写正确的语句: include using namespace std; class Base { 请在如下程序中的空格处填写正确的语句:include <iostream>using namespace std;class Base {public:void fun() {cout<<"Base fun"<<endl; }};class Derived: public Base {public:void fun() {【 】; //调用基类的函数fun()cout<<"Derived fun "<<endl;}};
请在下列程序的横线处填写正确的语句。include using namespace std; class Base{ publ 请在下列程序的横线处填写正确的语句。include<iostream>using namespace std;class Base{public:void fun(){cout<<"Base fun"<<endl;}};class Derivde:public Base{public:void fun(){______∥ 调用基类的函数