Article View: borland.public.cppbuilder.oodesign
Article #39How to make a template class friend of another class.
From: Wiljo
Date: Thu, 24 Feb 2005 09:24
Date: Thu, 24 Feb 2005 09:24
35 lines
1697 bytes
1697 bytes
Hi all,
I have a class with protected and/or private members that need to be accessed by
a close relative but template class. Normally one would make the second class
friend of the first, but when this second class is a template, how can I
accomplish it then?
//#
//# class A
//#
class A
{
public:
friend class B; //* This wont work, because class B is template
private:
void privateFunction();
};
//#
//# template class B
//#
template <class XType>
class B
{
public:
void myFunction( A *ptrA )
{ ptrA->privateFunction(); }
};
//#
//#
Any ideas would be greatly appreciated.
Wiljo.
Technical Details
Message-ID:
<421d9d32$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!fr.ip.ndsoftware.net!border2.nntp.ams.giganews.com!nntp.giganews.com!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!bandi.nntp.kabelfoon.nl!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10db1e,bcb6be07da14baed,start X-Google-Attributes: gid10db1e,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Thu, 24 Feb 2005 10:24:04 +0100 From: Wiljo <invalid@invalid.address> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040616 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.oodesign Subject: How to make a template class friend of another class. Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 81.207.96.249 Message-ID: <421d9d32$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1109237042 81.207.96.249 (24 Feb 2005 01:24:02 -0800) Lines: 35 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!fr.ip.ndsoftware.net!border2.nntp.ams.giganews.com!nntp.giganews.com!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!bandi.nntp.kabelfoon.nl!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail