Compiler Error C2846

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Compiler Error C2846.

constructor' : an interface cannot have a constructor

A Visual C++ interface cannot have a constructor.

The following sample generates C2846:

// C2846.cpp  
// compile with: /c  
__interface C {  
   C();   // C2846 constructor not allowed in an interface  
};  

Show: