若为Fraction类重载前增1运算符++,应在类体中将其声明为( )。

admin2020-07-30  20

问题 若为Fraction类重载前增1运算符++,应在类体中将其声明为(    )。

选项 A、Fraction&operator++();
B、Fraction&operator++(int);
C、friend Fraction&operator++();
D、friend Fraction&operator++(int);

答案A

解析 在类Fraction中重载前增1运算符++时,其声明形式为Fraction&operator++();在类Fraction中重载后增1运算符十+时,其声明形式为Fraction&operatorH(int);。
转载请注明原文地址:https://kaotiyun.com/show/Gxyp777K
0

相关试题推荐
最新回复(0)