In
database design and
object oriented program architecture,
has-a is a relationship where one object (often called the composited object) "belongs" to (is
a part or member of) another object (called the composite type), and behaves according to the rules of ownership. Multiple
has-a relationships will combine to form a possessive hierarchy. This is contrasted with an
Is-a relationship which constitutes a different kind of hierarchy (
subtyping). The decision whether the most logical relationship for an object and its subordinate is not always clearly
has-a or
is-a. Confusion over such decisions have necessitated the creation of these metalinguistic terms. A good example of the
has-a relationship is containers in the
C++ STL.
See also