Taru Taru - 1 year ago 94
C++ Question

How can I change the variable to which a C++ reference refers?

If I have this:

int a = 2;
int b = 4;
int &ref = a;

How can I make
refer to
after this code?

Answer Source

This is not possible, and that's by design. References cannot be rebound.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download