Extract Subclass
Basics
The Extract Subclass refactoring enables extracting certain members of a class into a subclass.
Example
Before | After |
---|---|
To extract a Subclass
Extracting the class dependent members
Let's consider the following sample of code: As you can see, variablefv
here depends on static constant
d2
. If you apply Extract Subclass refactoring to the above class and try to select
d2
to be moved, and leave fv
in the initial class, CLion highlights the problem member in
Extract Subclass 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.
See Also
Last modified: 29 March 2017