Mail Archives: djgpp/1997/08/06/09:50:27
Erik Max Francis (max AT alcyone DOT com) wrote:
: Insomnia wrote:
: > > Is there any way to overload the << operator as a friend function in a
: > > class in djgpp? I tried the following:
: > >
: > > friend ostream &operator<<(ostream &, MyClass &);
: > >
: > > Unfortunately, djgpp didn't like this. Anyone have any ideas?
: > >
: > Try:
: > friend ostream &operator << (ostream &, const MyClass &);
: > ^^^^^
: > This works fine for me.
That's not the problem for sure! It is allowed to declare the parameter as non-const.
It would be helpful to have a look at a larger piece of code, because the piece you
posted looks right. I used overloading of the ostream operator<< with DJGPP and it
worked fine.
cu
guenther
- Raw text -