string s1("some value");
string *sp1 = &s1;
string s2("another");
string *sp2 = &s2;
// sp1的存放对象的地址并没有改变,指示s1对象的值变为"another"
*sp1 = "a new vaue";
cout << s1 << endl; // a new vaue
// 改变指针sp1的地址值,sp1此时与sp2一样,指向s2
sp1 = sp2;
cout << *sp1 << "_" << *sp2 << endl; // another_another
如图: