#include <iostream>
#include <string>
using namespace std;
class Test
{
public:
Test(string &a) : str(a){}
Test& operator=(const Test& rhs)
{
str = rhs.str;
return *this;
}
string &str;
};
int main()
{
string str1("I Love China");
string str2("I Hate America");
string &r_str1 = str1;
string &r_r_str1 = r_str1;
r_str1 = "I Love China forever";
r_r_str1 = "I'm MJ";
cout << r_str1 << endl;
cout << str1 << endl;
cout << r_r_str1 << endl;
Test t(str1);
Test t2(str2);
t = t2;
cout << t.str << endl;
t.str = "abc";
cout << str2 << endl;
}