Pull Members Up
The Pull Members Up refactoring allows you to move class members to a base class.
Pulling members up
- Select the class to be moved to a superclass.
- On the main menu or on the context menu, choose Pull Members Up dialog box appears. . The
- Select the destination object (superclass).
- In the Members section, select the members you want to move.
- Click Refactor to pull the selected members to their destination.
Pulling up the dependent membersLet's consider the following sample of code: As you can see, there is a dependency between variables
d3. If you apply Pull Members Up refactoring to class
ChildClassand try to select
d3to be moved, and leave
d1in the class, CLion highlights the problem member in Pull Members Up 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.