题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-11-26 02:36:48

[单项选择]已知类Myst有一个只需要一个double型参数的构造函数,且将运算符“-”重载为友元函数。要使语句序列
Myst x(3.2),y(5.5),z(0.0);
z=8.9-y;
y=x-6.3;
能够正常运行,运算符函数operator-应该在类中声明为
A. friend Myst operator-(Myst&,Myst&);
B. friend Myst operator-(Myst,Myst);
C. friend Myst operator-(Myst,Myst&);
D. friend Myst operator-(Myst&,Myst);

更多"已知类Myst有一个只需要一个double型参数的构造函数,且将运算符"的相关试题:

[单项选择]已知类Myst有一个只需要一个double型参数的构造函数,且将运算符“-”重载为
友元函数。要使语句序列
Myst x(3.2),y(5.5),z(0.0);
z=8.9-y;
y=x-6.3;
能够正常运行,运算符函数operator-应该在类中声明为( )。
A. friend Myst operator-(Myst&,Myst&);
B. friend Myst operator-(Myst,Myst);
C. friend Myst operator-(Myst,Myst&);
D. friend Myst operator-(Myst&,Myst);
[单项选择]已知类Myst有一个只需要一个double型参数的构造函数,且将运算符“-”重载为友元函数。要使语句序列( )。
Myst x(3.2),y(5.5),z(0.0);
z=8.9-y;
y=x-6.3;
能够正常运行,运算符函数operator-应该在类中声明为( )。
A. friend Myst operator-(Myst&,Myst&);
B. friend Myst operator-(Myst,Myst);
C. friend Myst operator-(Myst,Myst&);
D. friend Myst operator-(Myst&,Myst);
[单项选择]已知类MyClas有一个只需要一个double型参数的构造函数,其将运算符“+”重载为友元函数。要使语句序列 MyClas x(1.2),y(2.3),z(0);z=x+y; 能够正常运行,运算符函数 operator+应在类中声明为( )。
A. friend MyClas operator+(int,MyClas&);
B. friend MyClas operator+(MyClas,MyClas);
C. friend MyClas operator+(MyClas,MyClas&);
D. friend MyClas operator+(MyClas&,MyClas);
[单项选择]在重载一个运算符时,如果其参数表中有一个参数,则说明该运算符是
A. 一元成员运算符
B. 二元成员运算符
C. 一元友元运算符
D. 选项B) 和选项C
[单项选择]如果友元函数重载一个运算符时,其参数表中没有任何参数则说明该运算符是
A. 一元运算符
B. 二元运算符
C. 选项A) 和选项B
D. 重载错误

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码