Topic: Friendship should be transitive (not about: Friendship inheritance)
Author: Valentin Bonnard <Bonnard.V@wanadoo.fr>
Date: 1999/09/14 Raw View
Yes friendship should obviously be transitive.
It is not the case only because some OO
bigots are affraid of the keyword friend
(the sort of people who would consider
some program to be badly written just
because there are hundreds of friends).
The (ugly) alternative is to provide the
services C needs as private B member
functions.
--
Valentin Bonnard
---
[ 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 ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: postmast.root.admi.gov@iname.com (blargg)
Date: 1999/09/15 Raw View
In article <37DE995E.6112@wanadoo.fr>, Valentin Bonnard
<Bonnard.V@wanadoo.fr> wrote:
> Yes friendship should obviously be transitive.
Perhaps not by default, though. If A makes B a friend, B's friends would
be A's friends too (that's certainly how it works in my life, generally).
I assume this is an issue of being conservative in language design.
> It is not the case only because some OO
> bigots are affraid of the keyword friend
> (the sort of people who would consider
> some program to be badly written just
> because there are hundreds of friends).
"But friends break encapsulation!!!!!!!!" :-) just kidding
> The (ugly) alternative is to provide the
> services C needs as private B member
> functions.
Yep. I've been having to do this lately. It's a mess. Sometimes I just
drop encapsulation when I'm fighting it too much. Sometimes I have to just
settle for getting the job done, as opposed to getting it done well.
---
[ 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 ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]