赞题库-背景图
单项选择题

有如下类定义: class Box{ public: Box(int h,int w,int l):width(w),length(l),height(h) { } private: int length,width,height; };Box 类中3个数据成员的初始化顺序为

A.length,height,width
B.length,width,height
C.height,width,lenth
D.width,length,height
<上一题 目录 下一题>
热门试题

单项选择题有如下类定义: class Cup{ public: void SetPrice(double val); private: double price; };若要在类体外给出对成员函数SetPrice的定义,下列选项中正确的是

A.void Cup::SetPrice(double val) { price=val; }
B.void Cup.SetPrice(double val) { price=val; }
C.void SetPrice(double val) { Cup::price=val; }
D.void SetPrice(double val) { Cup.price=val; }

单项选择题有如下程序:#include 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::funDerived::fun则程序中横线处应填入的语句是

A.Base.fun();
B.Base->fun();
C.Base::fun();
D.fun();