Skip to content
EntityQ1985787· pop 8· linked from 13 articles

Also known as has_a

In database design, object-oriented programming and design, 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.

~5 min read

Encyclopedic overview

7 sections
Contents
  • Related concepts
  • Examples
  • Entity–relationship model
  • UML class diagram
  • C++
  • See also
  • Notes

In database design, object-oriented programming and design, 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.

==Related concepts== "Has-a" is to be contrasted with an is-a (is_a or is a) relationship which constitutes a taxonomic hierarchy (subtyping).

Excerpted from Wikipedia’s “has-a” article, available under the CC BY-SA 4.0 licence.

Available in 8 languages

via Wikidata sitelinks · CC0