Aggregation versus Composition
From CSSEMediaWiki
(Difference between revisions)
(New page: Wikipedia provides a good ilustration of the difference Image:UniversityDepartmentProfessor.jpg) |
|||
Line 1: | Line 1: | ||
− | + | [[Image:UniversityDepartmentProfessor.jpg|frame|Aggregation versus Composition]] | |
+ | Wikipedia provides us a good example to illustrate the difference between aggregation and composition. | ||
+ | '''Composition''' (represented by the solid diamond) occurs inside objects when the relationship is such that if the super-object is destroyed the sub-object also ceases to exist. In this example if the university is closed the departments also close. | ||
+ | |||
+ | '''Aggregation''' (represented by the hollow diamond) occurs in the case where the destruction of one object does not end the existence of the other. When the university closes the professors continue to exist. |
Revision as of 06:49, 9 September 2008
Wikipedia provides us a good example to illustrate the difference between aggregation and composition. Composition (represented by the solid diamond) occurs inside objects when the relationship is such that if the super-object is destroyed the sub-object also ceases to exist. In this example if the university is closed the departments also close.
Aggregation (represented by the hollow diamond) occurs in the case where the destruction of one object does not end the existence of the other. When the university closes the professors continue to exist.