> All true, but private in heritance is normally an indication of
> actually wanting a has-a relationship. Syntactic convenience is just
> another way of saying "can't be bothered to do it properly". :-)

I wouldn't word it that harshly!  Aggregations models HAS-A, and private
inheritance models IMPLEMENTED-IN-TERMS-OF.  If the member aggregate is
private (as it is for most well designed classes) then actually aggregations
can represent IMPLEMENTED-IN-TERMS-OF.  That is of course, not to mention
cases where you need to overload a virtual function, where inheritance is a
must.

> Also, inheritance should be avoided to minimize coupling (specifically
> compile dependency).

Well, AFAIK aggregation means having a member object of another type, and
that has no lesser compile-time dependencies than inheritance.  However, I
agree that the dependence can be swept clear by using the pimpl idiom, for
example.

-------------
Ehsan Akhgari

Farda Technology (http://www.farda-tech.com/)

List Owner: [EMAIL PROTECTED]

[ Email: [EMAIL PROTECTED] ]
[ WWW: http://www.beginthread.com/Ehsan ]

Every deep thinker is more afraid of being understood than of being
misunderstood. The latter perhaps wounds his vanity, but the former wounds
his heart, his sympathy, which always says: "Ah, why would you also have as
hard a time of it as I have?"
-Beyond Good And Evil, F. W. Nietzsche





Reply via email to