#include <iostream>
using namespace std;
int main() {
int k = 10;
int& foo = k;
auto bar = foo; //value of foo is copied!
bar = 5; //foo / k won't be 5
cout << "bar : " << bar << " foo : " << foo << " k : " << k << endl;
auto& ref = foo;
ref = 5;
cout << "bar : " << bar << " foo : " << foo << " k : " << k;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgayA9IDEwOwoJaW50JiBmb28gPSBrOwoJYXV0byBiYXIgPSBmb287IC8vdmFsdWUgb2YgZm9vIGlzIGNvcGllZCEKCWJhciA9IDU7IC8vZm9vIC8gayB3b24ndCBiZSA1Cgljb3V0IDw8ICJiYXIgOiAiIDw8IGJhciA8PCAiIGZvbyA6ICIgPDwgZm9vIDw8ICIgayA6ICIgPDwgayA8PCBlbmRsOwoJYXV0byYgcmVmID0gZm9vOwoJcmVmID0gNTsKCWNvdXQgPDwgImJhciA6ICIgPDwgYmFyIDw8ICIgZm9vIDogIiA8PCBmb28gPDwgIiBrIDogIiA8PCBrOwoJcmV0dXJuIDA7Cn0=