The TYPE_DATA macro expands into a set of declarations of static and virtual methods and members which have to be added to an application C++ class that wishes to use RTTI. More precisely, the following members are added:
protected: static const Type_info RTTI_obj; static void* RTTI_new(const Type_info*); public: static typeid RTTI_sinfo(); virtual void* RTTI_cast(typeid); virtual typeid RTTI_vinfo() const;
The member
is the static Type_info which represents this class.
has been described in the previous section. It creates a new object of
this type and returns it as a pointer cast to the Type_info parameter.
Both
and
return the
member of this (the static method is used for the STATIC_TYPE_INFO operation
while the other one by the TYPE_INFO operation). The last method,
,
returns a pointer to an object of this class cast to the typeid parameter
and is used by the PTR_CAST operation.