Compiler Error C2846
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 C2846

Error Message

'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
© 2016 Microsoft