我們不再支援此瀏覽器。
升級至 Microsoft Edge 以善用最新功能、安全性更新和技術支援。
'function' :虛擬函式不能在聯集 'union' 中
使用虛擬函式宣告等位。 您只能在類別或結構中宣告虛擬函式。 可能的解決方案:
將等位變更為類別或結構。
讓函式成為非虛擬。
下列範例會產生 C2571:
// C2571.cpp // compile with: /c union A { virtual void func1(); // C2571 void func2(); // OK };
此頁面有幫助嗎?