TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
George Porter
NA
7
2.4k
Overloading operators such as <<,>>,== etc.
Jan 28 2014 9:53 PM
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.
Reply
Answers (
6
)
Operator keyword
Convert sql data to xml format