Introduction to Object Oriented Programming, 3rd Ed
Chapter 16
Overriding
Outline
- Roadmap
- Difference from Overloading
- Overriding Comparison in Smalltalk
- Subclasses of Magnitude in Little Smalltalk
- Overridden Relationals
- Notating Overriding
- Replacement and Refinement
- Reasons to use Replacement
- Overriding a Default Method
- Overriding for Optimization
- More Efficient Versions in class True
- Downside of Replacement
- Refinement in Beta
- Example, Print Anchors
- Making Child Classes
- Simulating Refinement with Replacement
- Constructors use Refinement
- Overridng versus Shadowing
- Shadowing of Instance Variables in Java
- Shadowing Methods
- Overriding, Shadowing and Redefinition
- Covariance and Contravariance
- Contravariant Return Types
- A Safe Variance Change
- Chapter Summary
Other Material