Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
'typeid' used on managed or WinRT type 'type', use 'operator' instead
You cannot apply the typeid operator to a managed or WinRT type; use typeid instead.
The following sample generates C3185 and shows how to fix it:
// 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
};