🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac.programmer.codewarrior
Article #1114

Problem with friendly templates

#1114
From: Adin Hunter Baber
Date: Mon, 19 Nov 2001 20:13
28 lines
2028 bytes
I was told that if you want to have a template type be friends with one 
another you need to declare it like this:

template<class T>
class temClass
   {
   public:
      ...
      template<class U> friend class temClass<U>;
   ...
   };

However, if i write my code this way I get a "declaration syntax error" 
and the Error & Warnings Window has friend underlined.

One work around, that appears to work fine, is have the templates all 
derive from a common base class.  The base class contains the data that 
needs to be shared. When the sharing of data is necessary, one of the 
classes is upcast, and the appropriate data is accessed.

Current system:
Mac OS9.1 Dual 533 640 Meg RAM.

-- 
Adin Hunter Baber
"Death is lighter than a feather, Duty heavier than a mountain"
"...nevertheless, they fought on even though their homes were piles of ashes,
even though they knew they could not win they still fought on,..."
Technical Details
Message-ID: <mjolnir_DELETE_-279068.14135819112001@east.usenetserver.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cyclone2.usenetserver.com!usenetserver.com!newsfeeds-atl1.usenetserver.com!atlpnn01.usenetserver.com.POSTED!mjolnir_DELETE_

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f635e,45060c4a2ff696d4,start
X-Google-Attributes: gidf635e,public
X-Google-Thread: 10bcce,45060c4a2ff696d4,start
X-Google-Attributes: gid10bcce,public
X-Google-ArrivalTime: 2001-11-19 12:14:08 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cyclone2.usenetserver.com!usenetserver.com!newsfeeds-atl1.usenetserver.com!atlpnn01.usenetserver.com.POSTED!mjolnir_DELETE_
From: Adin Hunter Baber <mjolnir_DELETE_@soltec.net>
Newsgroups: comp.sys.mac.programmer.codewarrior,codewarrior.mac
Subject: Problem with friendly templates
Organization: Soltec
User-Agent: MT-NewsWatcher/3.1 (PPC)
Message-ID: <mjolnir_DELETE_-279068.14135819112001@east.usenetserver.com>
Lines: 28
X-Complaints-To: abuse@usenetserver.com
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly.
NNTP-Posting-Date: Mon, 19 Nov 2001 15:07:32 EST
Date: Mon, 19 Nov 2001 14:13:58 -0600