c++重载符号
来源:百度知道 编辑:UC知道 时间:2024/09/24 13:41:28
operator++(){++n} A是个类名 A i; ++i 是不是只为了调用 operator, i本身没有变化 操作的是函数内的n
对的~
返回值呢?
>> operator++(){++n}
>> i本身没有变化 操作的是函数内的n
operator++(){++n}
<==>
operator++(){++(this->n)}
n是类的一部分,n变了,事实上是i.n变了。所以++i以后,i还是变了。