Push Down Field
A field is used only by some subclasses.
Move the field to those subclasses.
Motivation
Push Down Field is the opposite of Pull Up Field. Use it when you don’t need a field in the superclass but only in a subclass.
Mechanics
- Declare the field in all subclasses.
- Remove the field from the superclass.
- Compile and test.
- Remove the field from all subclasses that don’t need it.
- Compile and test.
|
This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License |
