Collapse the table of content
Expand the table of content
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. ArchiveDisclaimer


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

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

The elements of a virtual declaration are as follows:

Declares a member function.
Defines the level of access to the base class. 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.

See Also

C++ Keywords

© 2015 Microsoft