Share via


typeof Goes to T::typeid

The typeof operator used in Managed Extensions for C++ has been supplanted by the typeid keyword in Visual C++.

In Managed Extensions, the __typeof() operator returns the associated Type* object when passed the name of a managed type. For example:

// Creates and initializes a new Array instance.
Array* myIntArray = 
   Array::CreateInstance( __typeof(Int32), 5 );

In the new syntax, __typeof has been replaced by an additional form of typeid that returns a Type^ when a managed type is specified.

// Creates and initializes a new Array instance.
Array^ myIntArray = 
   Array::CreateInstance( Int32::typeid, 5 );

See Also

Reference

typeid (C++ Component Extensions)

Concepts

General Language Changes (C++/CLI)