It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center
                            
                        
                    
                
                                6年前关闭。
            
                    
围绕运算符=复制重载和学习对象进行分配。为一个类编码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;
}


谢谢。

最佳答案

这与指定的行为不匹配,这是为了增加调用对象operator++的频率。

关于c++ - 此指针,operator =和operator++ ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15845872/

10-17 01:36