delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/06/11:05:45

Newsgroups: comp.os.msdos.djgpp
Date: Sun, 3 Aug 1997 12:25:10 -0400
From: Insomnia <insomnia AT degobah DOT core DOT binghamton DOT edu>
Subject: Re: Overloading the << operator.
In-Reply-To: <33e40528.21082895@news.bright.net>
Message-ID: <Pine.SUN.3.93.970803122401.8956A-100000@degobah>
References: <33e40528 DOT 21082895 AT news DOT bright DOT net>
MIME-Version: 1.0
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

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!

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019