Has-A Relationship

In OOP, Has-A relationships are relationships where one object contains, or controls another object. It is contrasted with an Is-A relationship.

Objects having Has-A relationships are models for composition, or an object being contained inside of the parent object.

Examples of Has-A Relationships:

In these examples, you notice that the objects are not related in a parent-child type of relationship. They (typically) cannot respond to the same type of events or messages.

Contrast this with the Is-A relationship that are models for Inheritance.

Page Last Updated: 15 Mar 2006, 05:59 AM