Tips and Tricks

Implementing Virtual Methods with Visual Assist

Visual Assist has a feature—Implement Virtual Methods—that makes it easy to implement an interface, or abstract methods of a base class. You don’t need to create anything manually.

Move the caret to a base or interface class in the declaration of your derived class, or to the derived class if you want to implement methods from all bases classes.

Open a refactoring menu—via the context menu or Shift+Alt+Q—and select Implement Virtual Methods.


A dialog will open, letting you choose the methods to implement.


Visual Assist updates the declaration of your class, and create stubs in its implementation. By default, an exception is placed in the body of each method.


You can change the default by modifying the VA Snippet for “Create from Usage Method Body”.


If you add methods to an interface, repeat the process and Visual Assist will automatically disable existing methods.


The declaration and implementation of your new method will be inserted in the correct locations, relative to the existing methods.


That’s all there is to it.

This article was contributed by Lei Zhu, student at the College of San Mateo, CA.

Leave a Reply