char& back(); const char& back() const;
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s1("hello");
cout << s1.back() << endl;
s1.back() = 'e';
cout << s1 << endl;
return 0;
}
来源:https://www.cnblogs.com/xpylovely/p/12083224.html