C++ reference: Assigning to reference changes the value of the variable being referred

Question | Apr 15, 2016 | rparekh 

C++ references cannot be re-seated and a change in reference, changes the underlying variable's value.

std::string s1("abc");

std::string s2("xyz");

std::string& ref = s1;

std::string *ptr= &s1;

std::cout << ref << " -- " << *ptr << std::endl;

ref = s2;

std::cout << s1 << " -- " << *ptr << std::endl;

What is the output of the above 2 print statements?

2015 nextptr