Compiler Error C3153
Visual Studio 2015
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 C3153.
interface' : you cannot create an instance of an interface
An interface cannot be instantiated. To use the members of an interface, derive a class from the interface, implement the interface members, and then use the members.
The following sample generates C3153:
// C3153.cpp
// compile with: /clr
interface class A {
};
int main() {
A^ a = gcnew A; // C3153
}
The following sample generates C3153:
// C3153b.cpp
// compile with: /clr:oldSyntax
#using <mscorlib.dll>
__interface A {
};
int main() {
A *a = new A; // C3153
}
Show: