In
knowledge representationKnowledge representation is an area of artificial intelligence research aimed at representing knowledge in symbols to facilitate inferencing from those knowledge elements, creating new elements of knowledge...
,
object-oriented programmingObject-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...
and design,
is-a or
is_a or
is a (subsumption) is a relationship where one class
D is a
subclassSubclass may refer to:* Subclass , a taxonomic rank intermediate between class and superorder* Subclass , a class that is derived from another class or classes...
of another class
B (and so
B is a
superclassSuperclass may be:* The global ruling class created by neoliberal globalization * Superclass , a book about global governance by David Rothkopf, and The Superclass List...
of
D).
In other words, "
D is a B" (
B subsumes D, or
D is-subsumed-by B) usually means that concept
D is a specialization of concept
B, and concept
B is a
generalizationA generalization of a concept is an extension of the concept to less-specific criteria. It is a foundational element of logic and human reasoning. Generalizations posit the existence of a domain or set of elements, as well as one or more common characteristics shared by those elements. As such, it...
of concept
D. For instance, a "fruit" is a generalization of "apple", "orange", "mango" and many others. One can say that an
apple is a fruit.
In
object-oriented programmingObject-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...
the
is-a relationship arises in the context of
inheritanceIn object-oriented programming , inheritance is a way to reuse code of existing objects, establish a subtype from an existing object, or both, depending upon programming language support...
concept. One can say that "apple" may
inherit all the properties common to all fruits, such as being a fleshy container for the seed of a plant.
The
is-a relationship is contrasted with the
has-aIn database design and object oriented program architecture, has-a is a relationship where one object "belongs" to another object , 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...
relationship, which constitutes the holonym-meronym hierarchy. It may also be contrasted with the
instance-of relation: see
type-token distinctionIn disciplines such as philosophy and knowledge representation, the type-token distinction is a distinction that separates an abstract concept from the objects which are particular instances of the concept...
.
When designing a model (e.g., a
computer programA computer program is a sequence of instructions written to perform a specified task with a computer. A computer requires programs to function, typically executing the program's instructions in a central processor. The program has an executable form that the computer can use directly to execute...
) of the real-world relationship between an object and its subordinate, a common error is confusing the relations
has-a and
is-a.
See also
- Has-a
In database design and object oriented program architecture, has-a is a relationship where one object "belongs" to another object , 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...
- Subsumption
Subsumption may refer to:* A minor premise in symbolic logic * The Liskov substitution principle in object-oriented programming* Subsumption architecture in robotics...
- Inheritance (computer science)
In object-oriented programming , inheritance is a way to reuse code of existing objects, establish a subtype from an existing object, or both, depending upon programming language support...
- Subtype
In programming language theory, subtyping or subtype polymorphism is a form of type polymorphism in which a subtype is a datatype that is related to another datatype by some notion of substitutability, meaning that program constructs, typically subroutines or functions, written to operate on...
- Liskov substitution principle
Substitutability is a principle in object-oriented programming. It states that, in a computer program, if S is a subtype of T, then objects of type T may be replaced with objects of type S without altering any of the desirable properties of that program...
(in object-oriented programmingObject-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...
)
- Hyponym