'function' :純規範或抽象覆寫規範只能在虛擬函式上允許
備註
非虛擬函式會指定為純 virtual。
範例
下列範例會產生 C2253:
// C2253.cpp
// compile with: /c
class A {
public:
void func1() = 0; // C2253 not virtual
virtual void func2() = 0; // OK
};
下列範例會產生 C2253:
// C2253_2.cpp
// compile with: /clr /c
ref struct A {
property int Prop_3 {
int get() abstract; // C2253
// try the following line instead
// virtual int get() abstract;
void set(int i) abstract; // C2253
// try the following line instead
// virtual void set(int i) abstract;
}
};