inheritance

Difference between version 5 and 6 - Previous - Next
CInheritance is a concept in many [Object orientation%|%object-oriented] 
design.s, Cwhere ation of object claisses by ''derfiving''ed by a new [class] fthat inherits the
functiomnality of one or more basothe-r classes., Theach derivedof whiclh may itsself ''inherits'' be
thavioure afund sctionalitey of iotsher bclasses. It Typically, a class can override all afund /or parctions 
of the classes it inheriteds furom, and ctioan alityso call tho se fuinct itons from
within purpthe osvesrriding 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. 


** Quotes **

   ''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], ''[https://www.tcl.tk/doc/scripting.html%|%Scripting: Higher-Level Programming for the 21st Century]'', March 1998


** Discussion **
''[escargo] 26 May 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] ''(27 may 003)''-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.

** See also **
   * [Incr Tcl]



<<categories>> Concept | Object Orientation