题目内容 (请给出正确答案)
[单选题]

有如下类声明: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) :XA(A) ,XB(B) {}

提问人:网友hf041018028 发布时间:2022-01-06
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
网友答案
查看全部
  • · 有3位网友选择 D,占比37.5%
  • · 有2位网友选择 A,占比25%
  • · 有2位网友选择 C,占比25%
  • · 有1位网友选择 B,占比12.5%
匿名网友 选择了D
[72.***.***.208] 1天前
匿名网友 选择了A
[183.***.***.225] 1天前
匿名网友 选择了B
[217.***.***.242] 1天前
匿名网友 选择了D
[222.***.***.218] 1天前
匿名网友 选择了C
[167.***.***.245] 1天前
匿名网友 选择了D
[164.***.***.96] 1天前
匿名网友 选择了A
[146.***.***.100] 1天前
匿名网友 选择了C
[234.***.***.182] 1天前
匿名网友 选择了D
[72.***.***.208] 1天前
匿名网友 选择了A
[183.***.***.225] 1天前
匿名网友 选择了B
[217.***.***.242] 1天前
匿名网友 选择了D
[222.***.***.218] 1天前
匿名网友 选择了C
[167.***.***.245] 1天前
匿名网友 选择了D
[164.***.***.96] 1天前
匿名网友 选择了A
[146.***.***.100] 1天前
匿名网友 选择了C
[234.***.***.182] 1天前
加载更多
提交我的答案
登录提交答案,可赢取奖励机会。
更多“有如下类声明: class XA{int x; public…”相关的问题
第1题
有如下类声明:class XA {int x;public:XA(int n) { x=n;}};class XB: public XA{int y;public:XB

有如下类声明: class XA { int x;public: XA(int n) { x=n;}};class XB: public XA{ int y;public: XB(int a, int b);};在构造函数朋的下列定义中,正确的是()。

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){}

点击查看答案
第2题
有如下类声明: 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):XA(a),XB(b){}

点击查看答案
第3题
有如下两个类声明 class AA { public: int m; }; class BB: protected AA{ int n; }; 在类BB中,

有如下两个类声明

class AA {

public:

int m;

};

class BB: protected AA{

int n;

};

在类BB中,数据成员m的访问属性是 _____ ,数据成员n的访问属性是 _______ 。

点击查看答案
第4题
有如下程序片段: class MIT{ int value; public: MIT(int n=0){ value=n; } }; MIT *ta , tb; 其中声明的MIT类的对象是() 。
点击查看答案
第5题
有如下类声明“class A{int x; ……};”,则A类的成员x是:()

A.公有数据成员

B.私有数据成员

C.公有成员函数

D.私有成员函数

点击查看答案
第6题
有如下类声明: class SAMPLE { int n; public: SAMPLE(int i=0):n(i)

有如下类声明: class SAMPLE { int n; public: SAMPLE(int i=0):n(i) { } void setValue(int nO); }; 下列关于getValue 成员函数的实现中,正确的是

A.SAMPLE::setValue(int nO){ n=nO;}

B.void SAMPLE::setValue(int nO){ n=nO;}

C.void setValue(int nO){ n=nO;}

D.(int nO){ n=nO;}

点击查看答案
第7题
有如下类声明: class Foo{ int bar; }; 则Foo类的成员bar是

A.公有数据成员

B.公有成员函数

C.私有数据成员

D.私有成员函数

点击查看答案
第8题
有如下类声明:class MyBASE{ int k: public; void set(int n){k=n;} int get() const{return k;}

有如下类声明: 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中保护的数据成员和成员函数的个数是()。

A.4

B.3

C.2

D.1

点击查看答案
第9题
有如下类声明:class MyBASE{int k;public:void set(int n){k=n;}int get()const{return k;}};cla

有如下类声明: 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中保护的数据成员和成员函数的个数是()。

A.4

B.3

C.2

D.1

点击查看答案
第10题
有如下类声明;class SAMPLE{int n;public:SAMPLE(int i=0):n(i){}void setValue(int n0);};下列

有如下类声明; 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.(int n0){n=n0;}

点击查看答案
账号:
你好,尊敬的用户
复制账号
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
欢迎分享答案

为鼓励登录用户提交答案,简答题每个月将会抽取一批参与作答的用户给予奖励,具体奖励活动请关注官方微信公众号:简答题

简答题官方微信公众号

警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

微信搜一搜
简答题
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反简答题购买须知被冻结。您可在“简答题”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
简答题
点击打开微信