[Exceptional C++ Style] Item 14: Order, Order!
White Wolf
wolof at freemail.hu
Mon Dec 13 12:07:49 EST 2004
effective-cpp-bounces at accu.org wrote:
> In message
> <C3571D9EA82596468B7C6D662C82B824051C52AB at RED-MSG-32.redmond.c
> orp.microso ft.com>, Herb Sutter <hsutter at microsoft.com> writes
>>
>>> Inheritance is a significantly stronger coupling relationship than
>>> friendship. At least Herb is consistent in getting the ranking
>>> slightly wrong, as it this ranking is mentioned in other books.
>>
>> When I say that friendship is the strongest relationship, I'm
>> thinking of the dependency on the class's members. Regular code
>> depends only on the public parts, derived classes depend on the
>> public and protected parts, and friends depend on the public,
>> protected, and private parts.
>>
>> So I argue that it is the strongest relationship, while agreeing with
>> the following that it is not the most pervasively visible
>> relationship. There's a difference between being the strongest link
>> and being the most consequential/visible link.
>
> In that case it is a definition that you should make
> explicit, because the definition of strength is otherwise
> unqualified and people will fall back on the associations
> normally used when describing relationship strength and
> thoughts of coupling, cohesion and dependency management in
> general. However, even after clarifying the terminology,
> friendship still ranks second: membership is a stronger binding.
Why? A member does not depend on the class containing it.
Attila
More information about the Effective-cpp
mailing list