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

Implicitly Abstract Classes

If a class has interface base type, and if the class does not implement all the interface's member functions, then the class is implicitly abstract, and you cannot instantiate the class.

For more information about abstract classes, see abstract.

// mcppv2_ref_class5.cpp
// compile with: /clr
interface struct MyInterface {
   void func1();
   void func2();
};

ref class MyClass : public MyInterface {
public:
   void func1(){}
   // void func2(){}
};

int main() {
   MyClass ^ h_MyClass = gcnew MyClass;   // C2259 
                        // uncomment MyClass::func2 to resolve
}

Community Additions

ADD
Show:
© 2015 Microsoft