Inheritance is a concept in many object-oriented designs, where an object is defined by a class that inherits the functionality of one or more other classes, each of which may itself inherit the functionality of other classes. Typically, a class can override functions of the classes it inherits from, and can also call those functions from within the overriding function.

The order of inheritance creates a conceptual hierarchy of classes, with classes near the top being more general and classes lower down being more specialized. A class from which another class inherits functionality is called a base of that the other class.

All classes in the hierarchy of an object must cooperate in the manipulation of the data members of the object, so encapsulation between them is lost. A lesson learned from decades of research, design and use of object systems is that as a rule of thumb composition is preferable to inheritance.


Implementation inheritance causes the same intertwining and brittleness that have been observed when goto statements are overused. As a result, OO systems often suffer from complexity and lack of reuse.
John Ousterhout, Scripting: Higher-Level Programming for the 21st Century , March 1998


escargo 2003-05-26: Depending on the language, deriving might be known as extending. Additionally, in some languages, it might not be possible to override inherited functions if the code says that overriding should not be possible.

TV 2003-05-27: Inheriting suggests you get something of value. I guess a lot of inheriting has to do with the method you can apply a certain function from a certain library to a certain datastructure. We seem to have all inherited string.h and libstring.o or something, which doesn't make us all wordprocessors. Also, the idea has to do with a hierarchical way of accessing various libraries in programs and their source code . In french I guess the word is 'succession' which is also intersting as in tending to.