Is it allowed to name the parameter in postfix operator ++?

后端 未结 3 604
借酒劲吻你
借酒劲吻你 2021-01-01 11:39

I am not using this code in any production environment, it is just for my understanding. Is this code valid (i.e. can I define my postfix operator like this?):



        
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-01 12:33

    a++ is equivalent to a.operator++(0);. Your code is valid

    13.5/7

    When the postfix increment is called as a result of using the ++ operator, the int argument will have value zero.

提交回复
热议问题