The following sample will generate an error because class X is marked abstract.
// abstract_keyword.cpp
// compile with: /clr
ref class X abstract {
public:
virtual void f() {}
};
int main() {
X ^ MyX = gcnew X; // C3622 cannot instantiate abstract class
} The following sample shows that the compiler will generate an error because a native class is marked abstract, when compiled with /clr.
// abstract_keyword_2.cpp
class X abstract {
public:
virtual void f() {}
};
int main() {
X * MyX = new X; // C3622
} The following sample will generate an error because function f is marked abstract.
// abstract_keyword_3.cpp
// compile with: /clr
ref class X {
public:
virtual void f() abstract {} // C3634
virtual void g() = 0 {} // C3634
};