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.
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!
Learn more about our help with Assignments:
C++