0

How can I override the "<<"-operator in C++?

Want to override the "<<", so that I can use it with my own class types/objects

21st Dec 2016, 4:11 PM
Retr0_Pr0gram
2 Réponses
+ 5
ostream & operator <<(ostream & o, const yourclass& obj) { o << obj.data; return o; } where obj.data is what you want to display.
21st Dec 2016, 4:57 PM
Karl T.
Karl T. - avatar
0
Tank you
21st Dec 2016, 9:23 PM
Retr0_Pr0gram