ProAnswers.org

What happens if you assign to a reference

can anybody tell me What happens if you assign to a reference?

thanks…

You change the state of the referent (the referent is the object to which the reference refers).

Remember: the reference is the referent, so changing the reference changes the state of the referent. In compiler writer lingo, a reference is an “lvalue” (something that can appear on the left hand side of an assignment operator).