Association

Another type of relationship is the association relationship. This type of relationship is unlike the dependency relationship. In this type of relationship, one object knows another object and is associated with it. This relationship is achieved by having one object as a property of another object. In the software community, this relationship type is also referred to as a has a relationship. For example, a car has an engine. If you think of any objects that you can relate to each other using the phrase has a, then that relationship is an association relationship. In our car example, the engine is a part of the car. Without an engine, the car can't carry out any functions. While the engine itself is a separate object, it is part of the car, and therefore there is an association between the car and the engine.

This association relationship can be divided into the following two categories:

  • Aggregation
  • Composition

Let's see what these two types of relationship are and how they differ from each other.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.65.65