[Tutor] Aggregation vs Composition

Alan Gauld alan.gauld at yahoo.co.uk
Mon Dec 11 17:29:14 EST 2017


On 11/12/17 00:40, boB Stepp wrote:
> I own this book, too.  I'll insert the portions of the text that I
> believe the OP is referring to.

Thanks for the clarification Bob.

>>> composition is aggregation*
> 
> On page 18 the author goes on to use a chess set as an example...
> 
> He continues in the next paragraph:
> 
> ... an aggregate relationship makes more sense.  Also keep in mind
> that composition is aggregation; aggregation is simply a more general
> form of composition.  Any composite relationship is also an aggregate
> relationship, but not vice versa."

That's true in Python, not so in other languages (eg C++)

> I think it is these last two sentences that are confusing the OP.

I think it probably is, it would confuse me too
the first time I saw them.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list