🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3757

Re: Anyone considered inheritable friendship?

#3757
From: Eugene Radchenko
Date: Thu, 21 Mar 1996 16:29
53 lines
3233 bytes
Russell Gold <goldr@inet.bis.adp.com> writes
>> But it is not. Inheritable friendship is a natural extension of
>> normal friendship (for tightly coupled classes) to tightly
>> coupled hierarchies.
>
>Except that hierarchies are necessarily open, so making a
>hierarchy a friend means that the original class becomes open to
>classes which were never imagined by its author.  You can never
>guarantee that a "tightly coupled hierarchy" will remain tightly
>coupled.  AFAIK there is no prohibition on making multiple members
>of the same hierarchy friends to the same class.  Doing this allows
>the original author to restrict access to only those members of the
>hierarchy which should have that access.

Why is everybody so obsessed with friend security? They are not for this
(read Strojstroup [sp?]).

>> In my project (that spawned the question) base class builds a
>> certain graph and derived classes decompose it in different ways
>> using helper objects
>> from other hierarchies. Nobody except those objects (and original
>> object tree, of course) has any business to that graph.
>
>So make each of those classes friends of the graph.
But this implies that we must have a closed list of all helper objects
which breaks the design (I want to be able to easily snap together
different approaches/algorithms -- evev if they are in different DLLs).
Similarly, in iostreams/streambufs trees, are you saying that each
streambuf must have a complete list of all streams?

>OR, you can use a little trick within the confines of the language.
[....]
Which is not very neat, IMHO...

            Bye                            Genie
--
-----------------------------------------------------------------------
Eugene V. Radchenko              Research associate, Computer Chemistry
E-mail: eugene@qsar.chem.msu.su                   Fax: +7-(095)939-0290 
Ordinary mail:     Chair of Organic Chemistry, Department of Chemistry,
                         Moscow State University, 119899 Moscow, Russia
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
 I don't think anyone on the C++ standards committee believes that all
 C++ programs should be strictly conforming.
                           Fergus Henderson, moderator of comp.std.c++



[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
Technical Details
Message-ID: <AIQ5MKn8N7@qsar.chem.msu.su>
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
References: <3149AC2A.42D2@bis.adp.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
From: "Eugene Radchenko" <eugene@qsar.chem.msu.su>
Newsgroups: comp.std.c++
Subject: Re: Anyone considered inheritable friendship?
Date: 21 Mar 1996 16:29:08 GMT
Organization: Lab. of Org.Synth., MSU
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <AIQ5MKn8N7@qsar.chem.msu.su>
References: <3149AC2A.42D2@bis.adp.com>
NNTP-Posting-Host: taumet.eng.sun.com
X-Mailer: dMail [Demos Mail for DOS v1.23]
Content-Length: 2257
X-Lines: 46
Originator: clamage@taumet