Thanks for working out the sample, but that doesn't
do what I'm after. As Pai-hung pointed out, what I was trying to do simply
isn't possible - as I expected. Try your example with the following modification
and you'll see:
Template< Derived > t2;
You can solve this, of course, by making
Template< Derived > also a friend (of the Derived class), but that simply
is to much fuzz for me... I can live with having the functions I intended to
protect being public.
----- Original Message -----
Sent: Saturday, December 30, 2000 4:03
Subject: RE: [Algorithms] Template
attached sample worked for me. You need a real "type" for the friend
How do I grant a template access to protected
functions of some other class, i.e.
template <class cType> class
class cDerived : public cObject
The above works for instances of cObject, but
not for the derived classes, where it generates an compiler error
saying that the protected function cannot be accessed.
Is there any way around this? Or is the only
alternative declaring tTemplate as a friend in all subclasses?