Example: extracting a function

This example demonstrates the process of extracting a function from an existing function.

Procedure

  1. Select the highlighted code as shown below.
    The screen capture shows the original code.
  2. Right-click the highlighted code and then click Refactor > Extract Function.
    The screen capture shows the highlighted code and the Extract Function menu item.
  3. In the Extract EGL function window, information about the new function, such as the function name and its parameters, are displayed.
    This screen capture shows information about the new function.
  4. Click Preview to preview the changes that will be made. Click OK to extract the function.
    This screen capture shows the changes that will be made to the existing function.
  5. After the extract operation, a new function is created as shown below.
    This screen capture shows the result code after the extract operation.

Feedback