Inheritance (object-oriented Programming) - Subclasses and Superclasses

Subclasses and Superclasses

See also: Modularity

A subclass, heir class, or child class is a modular, derivative class that inherits one or more properties from another class (called the superclass, base class, or parent class). The properties in question vary from language to language, but commonly include class data variables, properties, and methods or functions. Some languages support the inheritance of other properties as well. For example, in Eiffel, contracts which define the specification of a class are also inherited by heirs. The superclass establishes a common interface and foundational functionality, which specialized subclasses can inherit, modify, and supplement. The software inherited by a subclass is considered reused in the subclass.

In some cases, a subclass may customize or redefine a method inherited from the superclass. A superclass method which can be redefined in this way is called a virtual method.

Read more about this topic:  Inheritance (object-oriented Programming)