Derived class

from Wikipedia, the free encyclopedia

A derived class - also a subclass , subclass (from English subclass ), subordinate class or child class (from English child class ) - is a descendant of another class , the base class , created by the programming concept of inheritance in object-oriented programming . In some programming languages, such as C ++ , it is also possible to derive classes from several other classes via multiple inheritance .

The derived class inherits all attributes (members) and methods of the base class, but can only directly access those not declared as private. In addition to the inherited methods and attributes, you can declare your own in the derived class. Methods of the base class provided for this purpose can also be overwritten by declaring a method with an identical signature in the derived class .

Some programming languages ​​allow so-called final classes that cannot be derived. For example, classes marked with final may not be used as base classes in Java ; in C # the corresponding keyword is sealed .

Individual evidence

  1. a b Bjarne Stroustrup: The C ++ programming language. Addison-Wesley, 2000, ISBN 3-8273-1660-X . Cape. 2.6.2 Class hierarchies.
  2. a b Introduction to programming Microsoft .NET Framework applications with Visual Studio 2005. Microsoft Learning, 2007, chap. 7.2 Implementing Inheritance.
  3. a b c Christian Ullenboom: Java is also an island. Galileo Computing, 2009, ISBN 978-3-8362-1371-4 , Chapter 6.8.1 Inheritance in Java.