给定以下代码,ixAdd会执行您期望的操作,即在增量之前返回ix的值,但在离开函数之前增加类成员吗?
class myCounter {
private int _ix = 1;
public int ixAdd()
{
return _ix++;
}
}
Run Code Online (Sandbox Code Playgroud)
当程序离开函数的堆栈帧(或Java中的任何内容)时,我不太确定post/pre increment的通常规则是否也适用于return语句.