Extract superclass
Refactor | Extract/Introduce | Superclass
The Extract Superclass refactoring enables extracting certain members of a class into a superclass. In CLion, this refactoring is available for C++, Objective-C/C++, Python and JavaScript code.
Before | After |
---|---|
|
|
Before | After |
---|---|
|
|
Before | After |
---|---|
|
|
Before | After |
---|---|
|
|
In the editor, select the class members that you want to extract into a superclass.
Choose Refactor | Extract/Introduce | Superclass from the main menu or Refactor | Extract Superclass from the context menu.
In the Extract Superclass dialog, specify the following:
Name of the new superclass in the Extract superclass from field.
Members to be included in the superclass.
Click Preview to check the refactoring result before proceeding. CLion will notify you in case of problems.
Dependency problems are also highlighted in the Extract dialog:
Click Extract to proceed with the refactoring. CLion will create a superclass and modify the original class to inherit from it .
Thanks for your feedback!