Notes on Inheritance
- Superclass may be complete class (can instantiate).
- Superclass may be abstract
(incomplete; cannot instantiate).
- In subclass, invoke superclass constructor with
- Inherited state and methods are not
repeated in subclass.
- Polymorphism and dynamic binding work the same as with
- A redefined method (same signature, new body)
overrides method from superclass; redefined
method is executed instead.
private instance variables & methods cannot be
accessed/used directly by the subclass
public instance variables & methods can (but are
visible to anyone)
protected is new keyword: accessible to class and
its subclasses, but not to other classes
Alyce Brady, Kalamazoo College