I am reading this article on lvalue and rvalue. I don't quite get this code:
int x;
int& getRef ()
{
return x;
}
getRef() = 4;
First, how does return x
give you a reference to x
? Shouldn't it be something like return addressof(x)
?
Second, what exactly does getRef() = 4
do? Is this suppose to be an assignment? I am at a loss here.