63
Pull Up Field
Goal
A field declared identically in two or more subclasses moves to the shared superclass.
Before the refactoring
class Manager extends Employee { _name; }
class Engineer extends Employee { _name; }After the refactoringclass Employee { _name; }
class Manager extends Employee {}
class Engineer extends Employee {}Savings
One source of truth for the field's type and default; subclasses focus on what they actually specialize.
Note
Pulling up a field that subclasses use differently (different default, different visibility) creates surprise — verify the field semantics are identical.