Sometimes an object is made up of other objects.
For example, an airplane is made up of a fuselage, wings, engines, landing gear, flaps, and so on.
Class Composition
Caption: As you may remember from high school geometry, a line is defined by two points. Thus, the Line class might have two Point
attributes (each one an instance of the Point class).
Caption: Composition is when one class contains another class as an attribute. Composition is indicated in a class diagram by connecting
the owning class to the owned class with a line.
Caption: Generally, the type and direction of the relationship are indicated by a few words such as "has a," "owns a," "uses a," or "refers
to," followed by an arrowhead indicating the direction of the relationship.
Caption: This picture shows only a single point, when in fact a Line object contains two Point objects. This is indicated by adding the
numeral 2 above the line and next to the point.