#include <iostream>
#include <string>
using namespace std;
string& funRef (string& s) {
string t = s;
return t;
}
int main() {
string s1 = "I'm a string!";
string& s2 = funRef(s1);
s2 = "YOUR STRING IS MINE";
cout << s1 << endl;
cout << s2 << endl;
}
why does it print out:
I'm a string!
\367\277_\377\367\277_\377M
I thought s2 was assigned with "YOUR STRING IS MINE".
what happen to the s2?