Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Composition is a special form of aggregation wherein each part may belong to only one whole at a time. When the whole is destroyed, so are its parts.
|
“Composition: A form of aggregation which requires that a part instance be included in at most one composite at a time, and that the composite object is responsible for the creation and destruction of the parts. Synonym: composite aggregation.” (UML 2) What they mean: Formally, composition is a specific kind of aggregation. In aggregation, a part may belong to more than one whole at the same time; in composition, however, the object may belong to only one whole at a time. The parts are destroyed whenever the whole is destroyed. |