編譯器錯誤 C3185
Managed 或 WinRT 類型 'type' 上使用 'typeid',請改用 'operator'
您無法將 typeid 運算子套用至 Managed 或 WinRT 類型;請改用 typeid 。
下列範例會產生 C3185,並示範如何修正此問題:
// C3185a.cpp
// compile with: /clr
ref class Base {};
ref class Derived : public Base {};
int main() {
Derived ^ pd = gcnew Derived;
Base ^pb = pd;
const type_info & t1 = typeid(pb); // C3185
System::Type ^ MyType = Base::typeid; // OK
};