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.
Comments
Leave a comment