Overloaded operator[] question
I have a simple question but could find the answer in a thread...
I have a myString class and overloaded the operator[] with
Code:
char& operator[](unsigned int index);
const char& operator[](unsigned int index) const;
(Actually it's the same as in the vector class: http://www.cppreference.com/cppvecto...operators.html)
In my main Routine I have the following:
Code:
myString test("hello");
test[0]='c';
printf("%c\n", test[0]);
My question is, why in both cases only the first overloaded function is called... Is there a way to separate assignment and return-value?
Greetings, Dee