Extract Method (C++)

From RAD Studio
Jump to: navigation, search

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.

VA extract method.png

To perform this feature, follow the next steps:

  1. Set the cursor in the symbol.
  2. Go to the Refactor option of the main menu.
  3. Select Extract Method.
  4. When the Extract Method window opens, enter the new method name of the symbol in the text field.
  5. See the preview of your method in the Preview of method signature field.
  6. Check the Extract to Source checkbox if you desire to do so.
  7. Click OK to extract the method or Cancel to exit the feature.

See Also