Post-increment Operator Overloading

前端 未结 3 1679
孤独总比滥情好
孤独总比滥情好 2020-12-03 08:08

I\'m having problems trying to overload the post increment operator in C#. Using integers we get the following results.

int n;

n = 10;
Console.WriteLine(n);         


        
3条回答
  •  -上瘾入骨i
    2020-12-03 08:39

    You should always return the changed value. C# uses this as the new value, and returns the old or new value as appropriate for the operator.

提交回复
热议问题