Sunday, 24 April 2016

What is Composition ?


Composition
  • This is a stringer form of aggregation.
  • It expresses relationship between a ‘container’ and ‘contained’ or ‘part’.
  • The container is responsible for creation and deletion of its parts.




Example

In composition, the attribute is contained by value.

Composition = Aggregation with lifetime control


Shown  by filled diamond at the "owner" side


Lifetime control: Construction and destruction controlled by "owner" →  Call constructors and destructors (or have somebody else do it)
Lifetime control implied.

Lifetime control can be tranferred.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.