[单选题]

有如下类声明:

class XA{

int x;

public:

XA(int U)}x=n;}

};

class XB:public XA{

int y;

public:

XB(int a,int B) ;

};

在构造函数XB的下列定义中,正确的是

A.XB::XB(int a,int B) :x(A) ,y(B) {}

B.XB::xB(int a,int B) :XA(A) ,y(B) {}

C.XB::XB(int a,int B) :x(A) ,XB(B) {}

D.XB::XB(int a,int B) :XA(A) ,XB(B) {}

参考答案与解析:

相关试题

有如下类声明: class XA { int x; public: XA(int

[单选题]有如下类声明: class XA { int x; public: XA(int n){x=n;} }; class XB:public XA { int y; public: XB(int a,int b); }; 在构造函数XB的下列定义中,正确的是A.XB::XB(int a,int b):x(a),y(b){}B.XB::XB(int a,int b):XA(a),y(b){}C.XB::XB(int a,int b):x(a),XB(b){}D.XB::XB(int a,int b):

  • 查看答案
  • 有如下类声明: class XA{int x; public: XA(int n

    [单选题]有如下类声明:class XA{int x;public:XA(int n){x=n;}};class XB:public XA{int y;public:XB(int a, int b) ;};在构造函数XB的下列定义中,正确的是A.XB::XB(int a,int B) :x(A) ,y(B) {}B.XB::XB(int a,int B) :XA(A) ,y(B) {}C.XB::XB(int a,int B) :x(A) ,XB(B) {}D.XB::XB(int a,int B) :X

  • 查看答案
  • 有如下类声明:class XA {int x;public:XA(int n)

    [单选题]有如下类声明: class XA { int x; public: XA(int n) {x=n;} }; class XB: public XA{ int y; public: XB(int a,int b); };在构造函数XB的下列定义中,正确的是______。A.XB:: XB(int a, int b):x(a),y(b) { }B.XB::XB(int a, int b):XA(a),y(b){}C.XB::XB(int a,int b):x(a),XB(b)i}D.XB::XB(i

  • 查看答案
  • 有如下类声明:class XA{int x;public:XA(int n){x

    [单选题]有如下类声明: class XA{ int x; public: XA(int n){x=n;} }; class XB:public XA{ int y; public: XB(int a,int b); }; 在构造函数XB的下列定义中,正确的是( )。A.XB::XB(int a,int b):x(a),y(b){}B.XB::XB(int a,int b):XA(a),y(b){}C.XB::XB(int a,int b):x(a),XB(b){}D.XB::XB(int a,int b

  • 查看答案
  • 有如下类声明:class XA{int X;public:XA(int n){x

    [单选题]有如下类声明: class XA{ int X; public: XA(int n){x=n;} }; class XB:publicXA{ int y; public: XB(int a,int b); ); 在构造函数XB的下列定义中,正确的是( )。A.XB::XB(int a,int b):x(a),y(b){}B.XB::XB(int a,int b):XA(a),y(b){}C.XB::XB(int a,int b):x(a),XB(b){}D.XB::XB(int a,int b)

  • 查看答案
  • 有如下类声明:class XA{int X;public:XA(int n){x

    [单选题]有如下类声明: class XA{ int X; public: XA(int n){x=n;} }; class XB:public XA{ int y; public: XB(int a,int b); }; 在构造函数XB的下列定义中,正确的是( )。A.XB::XB(inta,int b):x(a),y(b){}B.XB::XB(int a,int b):XA(a),y(b){}C.XB::XB(int a,int b):x(a),XB(b){}D.XB::XB(int a,int b)

  • 查看答案
  • 有如下类声明:classXA{intx:public:XA(intn){x=n;

    [单选题]有如下类声明:classXA{intx:public:XA(intn){x=n;}};classXB:publicXA{inty;oublic:XB(inta,intb);};在构造函数XB的下列定义中,正确的是( )。A.XB::XB(inta,intb):x(a),y(b){}B.XB::XB(inta,intb):XA(a),y(b){}C.XB::XB(inta,intb):x(a),XB(b){}D.XB::XB(inta,intb):XA(a),XB(b){}

  • 查看答案
  • 有如下类声明:class SAMPLE{int n;public:SAMPLE

    [单选题]有如下类声明:class SAMPLE{int n;public:SAMPLE (int i = 0): n(i){}void setvalue(int n0);};下列关于 setvalue 成员函数的实现中,正确的是A. . SAMPLE::setvalue(int n0){n = n0;}B. . void SAMPLE::setvalue(int n0){n = n0;}C. . void setvalue(int n0){n = n0;}D. . setvalue(int n0){n

  • 查看答案
  • 有如下类声明:class MyBASE{ int k: public; void

    [单选题]有如下类声明: class MyBASE { int k: public; void set(int n){k=n;} int get() const{return k;} }; class MyDERIVED: protected MyBASE { protected: int j; public: void set(int m, int n){MyBASE::set(m);j=n;} int get() const{return MyBASE::get()+j;} }; 则类MyDERIVE

  • 查看答案
  • 有如下类声明:class MyBASE{ int k;public: void

    [单选题]有如下类声明: class MyBASE { int k; public: void set(int n){k=n;} int get()const{return k;} }; class MyDERIVED:protected MyBASE { protected: int j; public: void set(int m, int n) {MyBASE::set(m);j=n;} int get()const{return MyBASE::get()+j;} }; 则类MyDERIVED中

  • 查看答案
  • 有如下类声明: class XA{ int x; public: XA(int