class TextBlock {
const char& operator[] (std:size_t position) const
{return text[position];}
char& operator[] (std:size_t position)
{return text[position];}
std::string text;

for the member functions why the return type is reference to char char& instead of char?
return text[position] is a char for sure,not an address, is this contradictory?


No since the return type is of char reference, that means you can
change the value while accessing it as well.