🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Anyone considered inheritable friendship?

#3646
From: Eugene Radchenko
Date: Wed, 13 Mar 1996 04:18
48 lines
3403 bytes
clamage@Eng.Sun.COM (Steve Clamage) writes:
>In article AFVop7nqs7@qsar.chem.msu.su, "Eugene Radchenko" <eugene@qsar.chem.msu.su> writes:
[...]
>>I think we should allow inheritable friendship (probably in addition to
>>current non-inheritable one). Anyway, we are not creating the Pentagon
>>security system and thus should not be much afraid of deriving Spy from
>>TrustedUser. Especially considering that otherwise all ends in making this
>>data public.
>
>I don't see much difference between allowing friendship to be inherited
>and making all class members public. The purpose of access control is
>not to hide implementation details from other programmers, because it
>does not do that. The purpose is more to prevent other parts of the
>program from depending on implementations details as opposed to depending
>only on the public interface.
>
>If friendship is inheritable, you cannot know what functions have access to
>the implementation details of the class. That means that you cannot change
>those details. You might as well make everything public. The effect on
>program design and maintenance is comparable.

But it is not. Inheritable friendship is a natural extension of normal
friendship (for tightly coupled classes) to tightly coupled hierarchies.
One possible example is the streambuf/iostreams hierarchies.
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.

               Best regards                      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 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]
Technical Details
Message-ID: <AFwV3Hn027@qsar.chem.msu.su>
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern
References: <4fnrfr$7b1@engnews1.Eng.Sun.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern
From: "Eugene Radchenko" <eugene@qsar.chem.msu.su>
Newsgroups: comp.std.c++
Subject: Re: Anyone considered inheritable friendship?
Date: 12 Mar 1996 20:18:11 PST
Organization: Lab. of Org.Synth., MSU
Approved: austern@isolde.mti.sgi.com
Message-ID: <AFwV3Hn027@qsar.chem.msu.su>
References: <4fnrfr$7b1@engnews1.Eng.Sun.COM>
NNTP-Posting-Host: isolde.mti.sgi.com
X-Original-Date: Mon, 11 Mar 1996 17:26:02 +0300 (MSK)
X-Mailer: dMail [Demos Mail for DOS v1.23]
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBVAwUBMUZMlUy4NqrwXLNJAQHRQQIAxe/Zux3AjyjyuCt1HiPgz7LJ7dP5tcTG
 SecfcZIY5MJdjkwKMtGiRstp43Yf2MvsM/3J/Zw9QluRtr4UonWD2Q==
 =cR+Y
Originator: austern@isolde.mti.sgi.com