|
|
Inheritance represents the “is a” relationship between types of objects. In practice it may be used to simplify the creation of a new class. It is the primary tool for reusing your own and standard library classes. Inheritance allows a programmer to derive a new class (called a derived class or a subclass) from another class (called a base class or superclass). A derived class inherits all the data fields and methods (but not constructors) from the base class and can add its own methods or redefine some of the methods of the base class. With the size and complexity of modern programs, reusing code is the only way to write successful programs in a reasonable amount of time.
|