#include<iostream> #include<string> #include<vector> using namespace std; class Test { private: char *text; public: char &operator[](int pos) const { return text[pos]; } Test(char * s) { text=s; } }; int main() { const Test x("Hello"); //cout<<x[0]<<endl; char *pc=&x[0]; *pc='j'; cout<<x[0]<<endl; }