What is the difference between aggregation and composition? - ProProfs Discuss
Advertisement

What is the difference between aggregation and composition?

Asked by Joshua, Last updated: Mar 26, 2024

+ Answer
Request
Question menu
Vote up Vote down

1 Answer

John Smith

John Smith

John Smith
John Smith

Answered Sep 09, 2016

Several definitions exist for aggregation and composition based on the following elements:

Accessibility: The part objects are only accessible through the whole object. Lifetime: the part objects are destroyed when the whole object is destroyed. Partitioning: the whole object is completely partitioned by part objects; it does not contain any state of its own. Both aggregation and composition represent a whole-part relationship.

Definition [aggregation] aggregation is a relationship between part and whole in which: Part may be independent of the whole; the relationship between part and whole is long-term; parts may be shared between two containers. Aggregation is identified by the phrase is-part-of. Aggregation cannot be circular, i.e. an object cannot be part of itself.

upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

Email Sent
We have sent an email to your address "" with instructions to reset your password.