If I have this:
int a = 2; int b = 4; int &ref = a;
How can I make ref refer to b after this code?
ref
b
Although its a bad idea as it defeats the purpose of using references, it is possible to change the reference directly
const_cast< int& >(ref)=b;