Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

virtual (C++)

The virtual keyword declares a virtual function or a virtual base class.

virtual [type-specifiers] member-function-declarator
virtual [access-specifier] base-class-name



Specifies the return type of the virtual member function.


Declares a member function.


Defines the level of access to the base class, public, protected or private. Can appear before or after the virtual keyword.


Identifies a previously declared class type.

See Virtual Functions and Virtual Base Classes for more information.

Also see the following keywords: class, private, public, and protected.

Community Additions

© 2015 Microsoft