Table of content

Move Implementation to Source File

Refactoring with Move Implementation to Source File provides C/C++ users with an efficient mechanism for moving the implementation of a function or method from a header file to a source file. This refactoring is often invoked after refactoring commands that place implementations in the header file for inline execution, e.g. Encapsulate Field.

Move Method Implementations to Source File—the plural version of the command—moves all methods of a class in a single operation.

You can modify the format of implementations by editing the VA Snippet for Create Implementation.


Place the caret on a function or method in a header file, and select Move Implementation to Source File from the Quick Action and Refactoring menu (Shift+Alt+Q).

Visual Assist moves the body to the appropriate source file. For methods, the implementation is placed within other implementations of the same class. Implementations of overloaded methods are moved near other overloads.

Visual Assist leaves behind a declaration in the header file.

Location of Implementation

By default, Visual Assist places new implementations near those of neighboring declarations. Alternatively, Visual Assist can create implementations at the EOF of a source file. Specify your preference in the options dialog for Visual Assist.

Template Implementations

By default, Move Implementation to Source File will move inline template implementations out of the class definition, but keep them in the header file. If the template implementation is outside the class definition, the implementation will be moved to a source file. If needed, you can refactor twice to move inline implementations outside the class definition, and then to the source file. You can turn off the custom behavior entirely by editing the registry.


Use the Navigate commands of Visual Assist to jump between the header file and source after Move Implementation to Source File. Immediately after the refactoring, Alt+Left returns you to the header file. Alt+Right returns you to the implementation.

Alternatively, use Open Corresponding File (Alt+O) to jump between the header file and source file.

Registry Settings

Value Name Meaning
MoveTemplateImplToSourceInTwoSteps Adjust Move Implementation for templates