The Extract Superclass refactoring enables extracting certain members of a class into a superclass.
Extracting a superclass
To extract a superclass
- Select the desired class in one of the views, or just open it in the editor.
- On the on the main menu or on the context menu, choose .
- In the Extract Superclass dialog box that appears, specify the following information:
- Name of the new superclass.
- Members to be included in the superclass
- Proceed with the refactoring.
Extracting the class dependent membersLet's consider the following sample of code: As you can see, there is a dependency between array
exRes. If you apply Extract Superclass refactoring to the above class and try to select
exResto be moved, and leave
ain the base class, CLion highlights the problem member in Extract Superclass dialog, as following:
Trying to proceed with extract, you will get the following warning message:
Choose Continue to ignore the problem and proceed with refactoring, or Cancel to return back and resolve it. Also you can observe the conflict in Find Tool Window.