Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

OO Concept: Composition

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.

What they say:

“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.



  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint