(programming) In object-oriented programming, a set of classes related by inheritance. Each class is a "subclass" of another class - its "superclass". The subclass contains all the features of its superclass, but may add new features or redefine existing features. The features of a class are the set of attributes (or "properties") that an object of that class has and the methods that can be invoked on it.If each class has a just one superclass, this is called single inheritance. The opposite is multiple inheritance, under which a class may have multiple superclasses. Single inheritance gives the class hierarchy a tree structure whereas multiple inheritance gives a directed graph. Typically there is one class at the top of the hierarchy which is the "object" class, the most general class that is an ancestor of all others and which has no superclass. In computing, as in genealogy, trees grow downwards, which is why subclasses are considered to be "below" their superclasses. When invoking a method on an object, the method is first looked for in the object's class, then the superclass of that class, and so on up the hierarchy until it is found. Thus a class need only define those methods which are specific to it and it will inherit all other methods from all its superclasses. An object of the subclass can do everything that an object of the superclass can and possible more. C++ calls the superclass the "base class" and the subclass the "derived class" (not to be confused with a derived type).
Last updated: 2014-09-06