全部题库 / C++ / 试题详情
单选题 C++
2017-01-22

已知类Myset有一个只需要一个double型参数的构造函数,且将运算符“-”重载为友元函数。要使语句序列
     Mysetx(3.2),y(5.5),z(0.0);
     z=8.9-y;
y=x-6.3;
能够正常运行,运算符函数operator-应在类中声明为________。

A.friendMyset operator-(Myst&,Myst&);
B.friendMyset operator-(Myst,Myst);
C.friendMyset operator-(Myst,Myst&);
D.friendMyset operator-(Myst&,Myst);

参考答案

B

答案解析

略。