overloading operators

Feb 15, 2008 at 5:19am
Why overloading operators?? instead of using cout or cin??
I don't really understand this theme.
Feb 15, 2008 at 5:37am
I'm not sure I understand your question. But if you want to know more about why you can overload operators then you might want to read over at

http://www.parashift.com/c++-faq-lite/operator-overloading.html

Hope this helps.
Feb 15, 2008 at 5:20pm
Overloading operators like '>>' or '<<' is completely different from using cout and cin. cout and cin are just objects of the iostream, standard library. You could define your own objects of type iostream and do the same.
Operators need to be overloaded because normally the operators available work with standard data types like int, double, string .. If you want to use operators with user defined data types or if you want to change the default behavior of the operators on standard types, you will have to overload the operators. I hope this addresses your question
Topic archived. No new replies allowed.