Inheritance
- Allows a programmer
to reuse a class.
- Can take
and existing class, clone it, and make additions and modifications to the
clone.
- Original
class is referred to as the base, super, or parent class.
- The clone
is referred to as the derived, inherited, sub, or child class.
- Derived
classes automatically inherit functionality of the base class which they
may add to or override.
- In UML, inheritance is called generalization.
- In java, to implement inheritance we use the
key word extends when defining the class:
- public class Ch7AddButtons extends JFrame { … }