Extract Method (C++)
Go Up to Refactor Menu
Refactor > Extract Method
Note: This feature comes through Visual Assist.
The Extract Method feature moves a segment of code into a separate method and replaces the segment with a call to the extracted method.
It is possible to extract multiple lines or a segment of one. Visual Assist infers the return value and the parameters of the extracted method.
To perform this feature, follow the next steps:
- Set the cursor in the symbol.
- Go to the Refactor option of the main menu.
- Select Extract Method.
- When the Extract Method window opens, enter the new method name of the symbol in the text field.
- See the preview of your method in the Preview of method signature field.
- Check the Extract to Source checkbox if you desire to do so.
- Click OK to extract the method or Cancel to exit the feature.