Aggregation versus Composition

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
 
  [[Image:UniversityDepartmentProfessor.jpg|frame|Aggregation versus Composition]]
 
  [[Image:UniversityDepartmentProfessor.jpg|frame|Aggregation versus Composition]]
Wikipedia provides us a good example to illustrate the difference between aggregation and composition.
+
Wikipedia provides us the university 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.
 
'''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.
 
'''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:50, 9 September 2008

Aggregation versus Composition

Wikipedia provides us the university 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.

Personal tools