On Mon, 2004-04-12 at 15:35, Ehsan Akhgari wrote:

Hi

> > 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.

Yeah, ok, but if there is a virtual function to override, then you
probably want public inheritance anyway.

> > 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.

Yes, it was the pimple idiom I was thinking of.

-- 
Regards
Paul

Paul Grenyer
Email: [EMAIL PROTECTED]
Web: http://www.paulgrenyer.co.uk

Have you met Aeryn: http://www.paulgrenyer.co.uk/aeryn/?
Version 0.3.0 beta now ready for download




Reply via email to