Wiktionary
a. (context programming English) of the relationship between a class and any member of that class in object-oriented computer programming.
Wikipedia
In database design, object-oriented programming and design (see object oriented program architecture), has-a (has_a or has a) is a composition relationship where one object (often called the constituted object, or part/constituent/member object) "belongs to" (is part or member of) another object (called the composite type), and behaves according to the rules of ownership. In simple words, has-a relationship in an object is called a member field of an object. Multiple has-a relationships will combine to form a possessive hierarchy.
This is to be contrasted with an is-a (is_a or is a) relationship which constitutes a taxonomic 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.
To summarize the relations, we have
-
hypernym- hyponym (supertype-subtype) relations between types (classes) defining a taxonomic hierarchy, where
- for a subsumption relation: a hyponym (subtype, subclass) has a type-of (is-a) relationship with its hypernym (supertype, superclass);
-
holonym- meronym (whole/entity/container-part/constituent/member) relations between types (classes) defining a possessive hierarchy, where
- for an aggregation (i.e. without ownership) relation:
- a holonym (whole) has a has-a relationship with its meronym (part),
- for a composition (i.e. with ownership) relation:
- a meronym (constituent) has a part-of relationship with its holonym (entity),
- for a containment relation:
- a meronym (member) has a member-of relationship with its holonym ( container);
- for an aggregation (i.e. without ownership) relation:
- concept-object (type-token) relations between types (classes) and objects (instances), where
- a token (object) has an instance-of relationship with its type (class).