基于 operator= 复制重载和学习对象的分配。为类编码运算符++。
说明是:
Seti operator++( );
This operator simply increases the value of a Seti object's frequency
by 1 (to a maximum of 9), before returning a copy of itself.
NOTE: The frequency can never exceed 9.
我可以这样做吗:
Seti Seti::operator++( ) {
Seti temp;
temp = *this
if (temp.freq<9)
temp.freq+=1;
return temp;
}
谢谢。