|
Inheritance is an "is a" relationship between two classes of
objects.
A subclass ("child")inherits from its superclass ("parent").
A subclass automatically has the ability to do everything its
parent can do. That is, a child inherits all the parents
non-private methods.
A subclass automatically knows every its superclass knows.
That is, a child inherits all its parents non-private properties.
A subclass can override its superclass's methods and
provide new behavior by declaring a method with the identical signature as
its parent.
Wherever a superclass is used, the subclass can be
substituted. This is polymorphism.
|