ProAnswers.org

What will happen if i assign to a reference in c++?

hey buddy have you tried it??

if we Assigning to a reference then it changes the referred-to value, thus a ref is an Lvalue' (something that can appear on theL’eft-hand-side of an assignment statement) for the referred-to value. This insight can be pushed a bit farther by allowing references to be returned, thus allowing function calls on the left hand side of an assignment stmt.