Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Warning (level 1) C4486
Collapse the table of content
Expand the table of content

Compiler Warning (level 1) C4486

Error Message

'function' : a private virtual method of a ref class or value class should be marked 'sealed'

Since a private virtual member function of a managed class or struct cannot be accessed or overridden, it should be marked sealed.


The following sample generates C4486.

// C4486.cpp
// compile with: /clr /c /W1
ref class B {
   virtual void f() {}   // C4486
   virtual void f1() sealed {}   // OK

The following sample shows one possible use of a private sealed, virtual function.

// C4486_b.cpp
// compile with: /clr /c
ref class B {};

ref class D : B {};

interface class I {
   B^ mf();

ref class E : I {
   virtual B^ g() sealed = I::mf {
      return gcnew B;

   virtual D^ mf() {
      return gcnew D;

Community Additions

© 2015 Microsoft