Type the Fixable factory method
Type the Fixable factory method
Answer
public Fixable getFixable(int code) { switch (code) { case 1: return new FixWindow(); default: return new FixNothing(); } }
The declared return type is the interface Fixable; the concrete subclass chosen inside is invisible to the caller, who only ever holds a Fixable.