Category
Operators, C++-Specific Keywords
Syntax
typeid( expression ) typeid( type-name )
Description
You can use typeid to get runtime identification of types and expressions. A call to typeid returns a reference to an object of type const type_info. The returned object represents the type of the typeid operand.
If the typeid operand is a dereferenced pointer or a reference to a polymorphic type, typeid returns the dynamic type of the actual object pointed or referred to. If the operand is non-polymorphic, typeid returns an object that represents the static type.
You can use the typeid operator with fundamental data types as well as user-defined types.
When the typeid operand is a Delphi class object/reference, typeid returns the static rather than runtime type.
If the typeid operand is a dereferenced NULL pointer, the Bad_typeid exception is thrown.
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|