You can use the Use Supertype Where Possible refactoring command to change code to reference objects of a superclass (or other type) instead of objects of a subclass. The operation only changes the reference in places where your code can accommodate such upcasting. Typically you would use this refactoring operation to enable a single method to take as an argument different types of objects (all deriving from the same superclass). This operation might be particularly useful after you have used the Extract Superclass command. To change references to a supertype:
|