Answer to Question #528 in C++ for angel

Question #528
How can I make my class to be output into I/O streams?
1
Expert's answer
2010-08-03T11:20:46-0400
To do this you have to overload operators “and”. But if you want your class objects to be printed to the standard I/O streams you have to overload these operators in the form of external functions. Signature of overloading ostream& operator<<(ostream& os, const Foo& s). Note that the overloaded function must be a friend of your class if you want to show the flow of private data members of the class.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS