User:Ruud Koot/Inheritance (computer science)

In computer science, the term inheritance may be applied to a variety of situations in which certain characteristics are passed on from one context to another. The term originates with the biological concept of a parent passing on certain traits to a child.

Inheritance is typically used in the context of object-oriented programming, in which certain objects inherit attributes or behaviors from other objects. Languages implementing this form of inheritance include C++ and Java. In this context, inheritance creates an "is-a" relationship between data structures; this form of inheritance is also sometimes called subclassing, since one class is a subclass of another. The subclass, or child, inherits characteristics from its superclass, or parent. For example, a "Dog" class could inherit from a more generic "Mammal" class, which in turn may inherit from a generic "Animal" class. A "Dog" is a "Mammal", and a "Mammal" is an "Animal." For further discussion of inheritance in this context, see Inheritance (object-oriented programming).

Inheritance may also be used by genetic algorithms to mimic the genetic process of a parent passing on genes to a child. In this context, inheritance more closely resembles a biological process. For more on this usage of inheritance, see Inheritance (genetic algorithm).

The concept of inheritance may also be applied more generally to any process in computer science in which one context receives certain traits from another. For example, in some word processor applications, stylistic attributes such as font size, layout, or color, may be inherited from a template or from another document; a user may define specific attributes for some elements, while the remaining elements inherit attributes from a global style specification. Closely related to this is the use of inheritance in Cascading Style Sheets (CSS), a style description language commonly used in web design; here again, some stylistic attributes may be specifically defined, while other attributes are inherited, or "cascaded." In browsing websites, for example, a user may choose to apply his own style sheet defining font size, while other characteristics, such as font color and typeface, may be inherited from the site-wide style sheet.

There is disagreement among computer scientists about what comprises "true inheritance"; there are some who believe that in computer science, inheritance does not really make sense outside the context of object-oriented programming; there are others who tend to apply the concept more generally to any instance of one context passing some of its characteristics to another.

See also: Inheritance (object-oriented programming), Inheritance (genetic algorithm)

Paveld& overerving (informatica) &