Overloading operators such as <<,>>,== etc.
Hi, I have a problem to solve and I really don't know where to start. Here is the problem:
Implement a class that does string manipulation by overloading the following operators: <<, >>, = and ==. For example consider the following code:
StrShift example;
example = "John";
printf("\"example << 2\" results in %s\n", example << 2);
In the above code the output would be "hnJo" which shows the last two characters of the string "John" rotated to the left of the string. Please note that state is maintained so two calls of example << 1 would give the same end result as calling example << 2 once.