Compiler Error C2723
TOC
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

Compiler Error C2723

'function' : 'specifier' storage-class specifier illegal on function definition

The specifier cannot appear with a function definition outside of a class declaration. The virtual specifier can be specified only on a member function declaration within a class declaration.

The following sample generates C2723:

// C2723.cpp
struct X
{
   virtual void f();
   virtual void g();
};

virtual void X::f()
{   // C2723
}

void X::g()   // OK
{
}

int main()
{
}
Show:
© 2016 Microsoft