Newsgroups: comp.os.msdos.djgpp Date: Sun, 3 Aug 1997 12:25:10 -0400 From: Insomnia Subject: Re: Overloading the << operator. In-Reply-To: <33e40528.21082895@news.bright.net> Message-ID: References: <33e40528 DOT 21082895 AT news DOT bright DOT net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII NNTP-Posting-Host: degobah.core.binghamton.edu Organization: Binghamton University Lines: 17 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Sun, 3 Aug 1997, Scott 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. --Insomnia --Sleep is for the weak!