User Defined Types  «Prev  Next»
Lesson 9 Object composition
Objective Describe how to use composition to build more complex objects from other objects.

Use Composition

Build More Complex Objects

Object diagrams demonstrating composition are similar to class diagrams showing composition. Most of the time, however, each separate object is given its own box, the actual values of the attributes are shown more often, and the relationship is generally not explicitly specified.

Object composition example

Depending on circumstances, different attributes of a class or object may or may not be shown in any one diagram. Much of the time, you are trying to show only certain attributes. In these cases, it's permissible to omit the attributes you aren't interested in. Simplifying a diagram by omitting the irrelevant parts of an object or class should make a diagram more intelligible.

Class Object Composition - Quiz

Click the Quiz link below to take a short quiz on class and object composition.
Class Object Composition - Quiz