🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Anyone considered inheritable friendship?

#3667
From: Steve Clamage
Date: Thu, 14 Mar 1996 14:51
46 lines
2943 bytes
mfinney@inmind.com writes:

>In <AFwV3Hn027@qsar.chem.msu.su>, "Eugene Radchenko"
><eugene@qsar.chem.msu.su> writes:
>>But it is not. Inheritable friendship is a natural extension of normal
>>friendship (for tightly coupled classes) to tightly coupled hierarchies.

>Exactly.  And, not only have I considered, I have begged for it
>on bended knee.  ...

>And it is NOT the same thing as making
>the attributes public.  It is the same thing as making them
>protected in another hierarchy.

Please notice that I did not say inherited friendship is the same
as making the members public. I said the effect on program design
and maintenance is the same.

If friendship is inherited, you cannot know what functions will
depend on the details of the private parts of the class. You cannot
know whether the unknown writers of these unknown functions will
get right all the inter-relationships among the private parts.
Since you don't know what programs will break if you make any changes
to the private parts, and you have no assurance of the correctness of
the use of these private members by unknown functions, you lose nothing
by making them public. By making them public, you avoid the false
sense of security which the "private" label seems to confer.

The point of making members private is that you have complete 
knowledge of who has access to them. If you need or want to make a
change, you know exactly who will be affected. If you allow friendship
to be inherited, you lose that knowledge, and private status 
provides no advantage.

Perhaps you can provide an example where inheritable friendship
gives a distinct advantage over making the members public. Bear
in mind that people you don't know about will be depending in
ways you don't know about on the private details of the class.
--
Steve Clamage, stephen.clamage@eng.sun.com
---
[ 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: <4i8b8a$2tj@engnews1.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
References: <4fnrfr$7b1@engnews1.Eng.Sun.COM> <AFwV3Hn027@qsar.chem.msu.su> <4i7qjr$gr7@mujibur.inmind.com>

Show Full Headers
Complete Article Headers
From: clamage@Eng.Sun.COM (Steve Clamage)
Message-ID: <4i8b8a$2tj@engnews1.Eng.Sun.COM>
X-Original-Date: 14 Mar 1996 05:36:10 GMT
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
Date: 14 Mar 96 14:51:41 GMT
Approved: fjh@cs.mu.oz.au
Newsgroups: comp.std.c++
Subject: Re: Anyone considered inheritable friendship?
Organization: Sun Microsystems Inc., Mountain View, CA
References: <4fnrfr$7b1@engnews1.Eng.Sun.COM> <AFwV3Hn027@qsar.chem.msu.su> <4i7qjr$gr7@mujibur.inmind.com>
X-Newsreader: NN version 6.5.0 #21 (NOV)
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMUgyjeEDnX0m9pzZAQHeAgF+MBjafLSw1NCNUyli424+Riqvg6Evuo4/
 f74ZqkYUONU9VfJgNAFEcdOgVXvF51a3
 =pmnU