The Extract Superclass refactoring lets you create a superclass for an existing class.
The members of the original class can be moved to the superclass. For a method, you can transfer only the method declaration but not the implementation, declaring the method as abstract in the superclass. As a result, you will have a superclass and the original class inheriting from the superclass.
Extract a superclass
Place the caret inside a class in the editor.
Choosefrom the main menu or from the context menu.
In the Extract Superclass dialog that appears, specify the following information:
Name of the new superclass in the Extract superclass from field.
Target file where the new superclass will be stored in the Extract superclass with members to directory field.
Select the members of the class to be included in the superclass in Extract superclass from.
If you want the methods in the superclass to be abstract, select the Make Abstract checkbox.
The Extract superclass from field displays the name of the class, from which a superclass should be extracted. It is read-only.
Click Refactor to proceed with the refactoring. The superclass is created and the original class is modified to inherit from it: