C++ Refactoring

Available C++ Refactorings

To access the C++ refactorings, from the main menu, click C/C++ Refactoring. The C++ Refactoring menu can be also be accessed from the right-click menus within the Symbols and Outline views.

Rename

Rename is used to rename variables, methods, and classes. It uses Context Tagging® to identify:

The symbol under the cursor (or any symbol selected in the Symbols or Outline views).

All of the symbol overloads.

All other instances of the symbol within the class hierarchy.

It then parses each file containing references to the selected symbol(s), and updates the rest of the code to use the changed name.

Figure 6.31. C++ Refactoring: Rename

Extract Method

After selecting a set of lines, Extract Method creates a new method with the selected lines as the body. It discovers any undeclared variables and creates them as parameters to the new method. The extracted method is created in the same scope as the original method.

Figure 6.32. C++ Refactoring: Extract Method

201

Page 223
Image 223
Slick V3.3 manual Available C++ Refactorings, Rename, Extract Method