Synchronize Declaration / Implementation

A very common programmers task is to adjust an existing method’s signature.
For example add or remove a parameter, change a procedure into a function, or change the function’s result type.
After you changed a method’s signature in the implementation (or declaration),
the “Synchronize Declaration / Implementation” refactoring updates the corresponding signature
in the declaration(or implementation) depending on the editor cursor position.

An example

Suppose you have a class TSample with a method DoSomething like this:


Suppose now that you want to change this method to a function, returning a Boolean. It also should have a parameter “Level: Integer”.

After changing the implementation header to the new signature…


…rather than manually adjusting the method declaration in the class interface, now press Ctrl+Alt+Y (default keyboard shortcut) to invoke the Synchronize Declaration / Implementation refactoring:


..that updates the declaration with the changes you made in the implementation.

Similar, if you modify the method signature in the class definition and press Ctrl+Alt+Y
in the declaration, the implementation signature – method type, parameter list and result type – are updated.

Note that the keyboard shortcut Ctrl+Alt+Y is a default and can be adjusted to your preferences.