Answer to Question #528 in C++ for angel
How can I make my class to be output into I/O streams?
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.
No comments. Be first!