P
Peter v. N.
Hi all,
Maybe this has been asked a million times before.
In that case I'm sorry for being to lazy to search
the Internet or look it up in a decent C++ reference:
I read in O'Reilly's C++ Pocket reference (see also
http://www.oreilly.com/catalog/cpluspluspr/errata/ ,
btw not that bad),
that the operator << has to be overloaded like this:
#include <ostream>
std:stream &MyClass:perator<<(std:stream &pOS, MyClass &pObj) const
{
return pOS << pObj.someMethod();
}
Implemented that way, Eclipse 3.2 (CDT) with gcc 4.0.1
(i686-apple-darwin8-gcc-4.0.1) report that << must take one and only
one argument. That's strange, isn't it?
What's the default implementation now?
Thank you for a hint pointing me in the right direction.
Brgds,
Peter
Maybe this has been asked a million times before.
In that case I'm sorry for being to lazy to search
the Internet or look it up in a decent C++ reference:
I read in O'Reilly's C++ Pocket reference (see also
http://www.oreilly.com/catalog/cpluspluspr/errata/ ,
btw not that bad),
that the operator << has to be overloaded like this:
#include <ostream>
std:stream &MyClass:perator<<(std:stream &pOS, MyClass &pObj) const
{
return pOS << pObj.someMethod();
}
Implemented that way, Eclipse 3.2 (CDT) with gcc 4.0.1
(i686-apple-darwin8-gcc-4.0.1) report that << must take one and only
one argument. That's strange, isn't it?
What's the default implementation now?
Thank you for a hint pointing me in the right direction.
Brgds,
Peter