'function' :虛擬函式不能在聯集 'union' 中
備註
使用虛擬函式宣告等位。 您只能在類別或結構中宣告虛擬函式。 可能的解決方案:
將等位變更為類別或結構。
讓函式成為非虛擬。
Example
下列範例會產生 C2571:
// C2571.cpp
// compile with: /c
union A {
virtual void func1(); // C2571
void func2(); // OK
};
'function' :虛擬函式不能在聯集 'union' 中
使用虛擬函式宣告等位。 您只能在類別或結構中宣告虛擬函式。 可能的解決方案:
將等位變更為類別或結構。
讓函式成為非虛擬。
下列範例會產生 C2571:
// C2571.cpp
// compile with: /c
union A {
virtual void func1(); // C2571
void func2(); // OK
};