为完成下面的程序,应在划线处填入的语句是 #include<iostream> using namespace std; class Base { private: int x; public: Base (int i) { x=i; } ~Base(){} }; class Derived:public Base { public: ______________//完成类Derive构造函数的定义 }; int main() { Derived Obj; return 0; }
A.Derived(int i):Base(i){}
B.Derived(){}
C.void Derived (int i):Base(i){}
D.Derived(int i){Base(i);}
第1题:
应在下列程序画线处填入的正确语句是 ( )。 #include <iostream> using namespace std; clas 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();
第2题:
为完成下面的程序,应在划线处填入的语句是( )。 #include <iostream> using namespace std; class Base { private: int x; public: Base(int i) { x=i; } ~Base(){} }; class Derived : public Base { public: _______________ //完成类Derive构造函数的定义 }; int main() { Derived Obj; return 0; }
A.Derived(int i):Base(i){}
B.Derived(){}
C.voidDerived(int i):Base(0){}
D.Derived(int i){Base(i);}
第3题:
按解释中的要求在下列程序划线处填入的正确语句是:() #include <iostream.h> class Base{ public: void fun() {cout<<"Base::fun"<<endl;} }; class Derived:public Base{ public: void fun() { _______________________//在此空格处调用基类的函数fun() cout<<"Derived::fun"<<endl;} };
A.fun();
B.Base.fun();
C.Base::fun();
D.Base->fun();
第4题:
有如下程序: #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();
第5题:
下列程序中划线处正确的语句是( )。#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();