| <<< References | Index | References themselves can't be changed >>> |
void swap( int& left, int& right )
{
int temp = left;
left = right;
right = temp;
}
void f()
{
int x = 8;
int i = 4;
int& ri = i;
++ri; // now i == 5
ri = x; // now i == 8
int& ref2 = 2; // error, RHS must be an lvalue
}
| <<< References | Index | References themselves can't be changed >>> |