On 2017-12-10, jia yue Kee <jiayu...@gmail.com> wrote: > Good Day All, > > I am new to Python and I came across the concept of Composition > and Aggregation the other day in Dusty Philips's Python 3: > Object-Oriented Programming book.
Welcome! > Based on my reading, what I gathered was that Composition > implies a relationship where the child cannot exist independent > of the parent while Aggregation, on the other hand, implies a > relationship where the child can exist independently of the > parent. > > However, in one of the paragraph of the book, *Dusty mentioned > that composition is aggregation* (refer to the snapshot below, > the sentence which has been highlighted in yellow). I am really > confused by this statement and I appreciate that if someone > could enlighten me on this as I do not really see how > aggregation can be equivalent to composition if the child in > one case can exist independently while the other could not > exist independently of the parent. Those statements are logically consistent if composition is a more strict form of aggregation--a form with the additional constrain that the objects cannot exist independently of their parent. In other words, in the text aggregation is a generlisation of composition. -- Neil Cerutti _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor