搜题
网友您好,请在下方输入框内输入要搜索的题目:
搜题
题目内容 (请给出正确答案)
提问人:网友luo_cs 发布时间:2022-01-07
[主观题]

Class Adder { private int x; public Adder(int a) { x=a; } private int increase(int basic) { return basic+x; } } Adder类的构造方法的访问控制权限是()。(写表示访问控制权限的关键字)

简答题官方参考答案 (由简答题聘请的专业题库老师提供的解答)
查看官方参考答案
更多“Class Adder { private int x; public Adder(int a) { x=a; } private int increase(int basic) { return b…”相关的问题
第1题
现有分数类: class Fraction { public: Fraction(int x, int y) {fenzi = x;fenmu = y;} private: int fenzi; int fenmu; };
点击查看答案
第2题
已定义类A: class A { private: int x; protected: int y; public: int z; A(int p1, int p2, int p3) { x = p1; y = p2; z = p3; } // 构造函数 }; 再定义派生类B: class B : public A { private: int a; public: // 定义派生类B的构造函数 }; 则下列派生类B的构造函数定义中,正确的是( )。

A、B(int p1, int p2, int p3, int p4) { a = p4; }

B、B(int p1, int p2, int p3, int p4) : A(p1, p2, p3) { a = p4; }

C、B(int p1, int p2, int p3, int p4) { x = p1; y = p2; z = p3; a = p4; }

D、B(int p1, int p2, int p3, int p4) { A(p1, p2, p3); a = p4; }

点击查看答案
第3题
Number类定义如下: public class Number { public int x; } swap方法定义如下: public static void swap(Number number1, Number number2) { int temp = number1.x; number1.x = number2.x; number2.x = temp; } 运行如下代码: Number number1 = new Number(); Number number2 = new Number(); Number number3 = new Number(); number1.x = 1; number2.x = 2; number3.x = 3; swap(number1, number2); swap(number2, number3); 则number1.x, number2.x, number3.x的值分别为:

A、1, 2, 3

B、2, 3, 1

C、3, 2, 1

D、1, 3, 2

点击查看答案
第4题
有如下TestA类的定义: public class TestA { static int a=10; } 用该类创建2个对象:testA1和testA2,现将类变量(静态变量)a的数值变为100,则正确的方式是:( )。

A、TestA.a=100;

B、testA1.a=100;

C、testA2.a=100;

D、其余选项都不对

点击查看答案
第5题
23. Sale by sample includes sale by seller’s sample, sale by buyer’s sample and sale by duplicate sample.
点击查看答案
第6题
已定义基类A和派生类B:class A { ptivate: int x; protected: int y; public: int z; void ShowA( ) { cout << x << y << z << endl; } }; class B : protected A // 保护继承 { private : int a; protected: int b; public: int c; void ShowB( ) { ShowA( ); cout << a << b << c << endl; } }; 再定义B的派生类C:class C : public B { public: int m; void fun( ) { x = 5; y = 5; z = 5; ShowA( ); } // 访问基类A的成员 }; 函数fun( )中错误的语句是( )。

A、x = 5;

B、y = 5;

C、z = 5;

D、ShowA( );

点击查看答案
第7题
已定义类A:class A { public: int x; static int y; }; int A::y = 0; 下列语句中错误的是( )。

A、A a; a.x = 1; a.y = 1;

B、A a; a.x = 1; A::y = 1;

C、A.x = 1; A.y = 1;

D、A::y = 1;

点击查看答案
第8题
指出下面程序段中的错误,并说明出错原因【 】。

class Location {

int X, Y=20;

protected:

int zeroX, zeroY;

int SetZero(int ZeroX, iht ZeroY);

private:

int length, height;

public:

float radius;

void init(int initX,int initY);

int GetX();

Int GetY();

};

点击查看答案
第9题
有基类如下: class BASE{ private: int x,y; public: BASE(int x,int y){this->x=x;this->y=y;} void set(int x1,int y1) { x=x1; y=y1; } ... }; 设DERIV为BASE的公有派生类,则下列哪个DERIV的构造函数对基类成员的初始化是正确的?

A、DERIV( int x, int y ) { BASE(x , y) ; ... }

B、DERIV( int x1, int y1 ){ x=x1; y=y1; ... }

C、DERIV( int x, int y ) : BASE( x , y ) { ... }

D、DERIV( int x, int y ) {set(x1,y1); ... }

点击查看答案
第10题
程序运行结果是 class Sample { static int i; public: void set(int x){i=x;} Sample(int i){this->i+=i;} static disp(){cout<< i;} }; int Sample::i=50; void main() { Sample s(10); Sample::disp(); }

A、10

B、50

C、60

D、110

点击查看答案
重要提示: 请勿将账号共享给其他人使用,违者账号将被封禁!
查看《购买须知》>>>
重置密码
账号:
旧密码:
新密码:
确认密码:
确认修改
购买搜题卡查看答案
购买前请仔细阅读《购买须知》
请选择支付方式
微信支付
支付宝支付
点击支付即表示你同意并接受《服务协议》《购买须知》
立即支付
搜题卡使用说明

1. 搜题次数扣减规则:

功能 扣减规则
基础费
(查看答案)
加收费
(AI功能)
文字搜题、查看答案 1/每题 0/每次
语音搜题、查看答案 1/每题 2/每次
单题拍照识别、查看答案 1/每题 2/每次
整页拍照识别、查看答案 1/每题 5/每次

备注:网站、APP、小程序均支持文字搜题、查看答案;语音搜题、单题拍照识别、整页拍照识别仅APP、小程序支持。

2. 使用语音搜索、拍照搜索等AI功能需安装APP(或打开微信小程序)。

3. 搜题卡过期将作废,不支持退款,请在有效期内使用完毕。

请使用微信扫码支付(元)

订单号:

遇到问题请联系在线客服

请不要关闭本页面,支付完成后请点击【支付完成】按钮
遇到问题请联系在线客服
恭喜您,购买搜题卡成功 系统为您生成的账号密码如下:
重要提示:请勿将账号共享给其他人使用,违者账号将被封禁。
发送账号到微信 保存账号查看答案
怕账号密码记不住?建议关注微信公众号绑定微信,开通微信扫码登录功能
警告:系统检测到您的账号存在安全风险

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

- 微信扫码关注简答题 -
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反简答题购买须知被冻结。您可在“简答题”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
- 微信扫码关注简答题 -
请用微信扫码测试
欢迎分享答案

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

简答题官方微信公众号

简答题
下载APP
关注公众号
TOP