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
Expand Minimize
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.

Compiler Error C3278

Error Message

direct call of interface method 'interface method' will fail at runtime

A call was made to an interface method, which is not allowed.

The following sample generates C3278:

// C3278_2.cpp
// compile with: /clr
using namespace System;
interface class I
{
   void vmf();
};

public ref class C: public I
{
public:
   void vmf()
   {
      Console::WriteLine( "In C::vmf()" );
      I::vmf(); // C3278
   }

};

int main()
{
   C^ pC = gcnew C;
   pC->vmf();
}

The following sample generates C3278:

// C3278.cpp
// compile with: /clr:oldSyntax
#using <mscorlib.dll>
using namespace System;

public __gc __interface I
{
   void vmf();
};

public __gc class C : public I
{
public:
   void vmf()
   {
      Console::WriteLine(S"In C::vmf()");
      I::vmf();   // C3278
   }
};

int main()
{
   C *pC = new C();
   pC->vmf();
}

Community Additions

ADD
Show:
© 2015 Microsoft