|Inheritance is the other mechanism peculiar to object
oriented programming languages to improve code reuse.
an “is a” relationship because the Derived class inherits all the data
members and member functions of the Base class, and is therefore itself one
object of the Base data type too;
|The Derived class
can override the implementation of some or all of the Base member functions,
and can also add some additional member functions or data members.
|The way inheritance
is used in object oriented programming is to create a more peculiar, more
specialized data type starting from an existing one, of which it reuses some
characteristics, for example:
|An opel astra is an
auto, a fiat punto is an auto, an opel astra turbo diesel is a specialized
version of an opel astra: