I have read in many places about references:
Reference is like a const pointer
Reference always refer to an object
Once initialised, a Reference cannot be reseated
I want to make myself clear on the last point. What does that mean?
I tried this code:
#include <iostream>
int main()
{
int x = 5;
int y = 8;
int &rx = x;
std::cout<<rx<<"\n";
rx = y; //Changing the reference rx to become alias of y
std::cout<<rx<<"\n";
}
Output
5
8
Then what does it mean by "References cannot be reseated"?