我试图理解这段代码:
int& getInt()
{
static int i = 5;
return i;
}
int main()
{
int a = getInt(); // function return variable by reference,but `a` is a copy of the variable returned by function
int& aa = getInt(); // `aa` is a reference of the variable returned by function
}
你能解释一下吗?