Tuesday, 17 April 2012

Write about the issues related to the runtime type identification. | C++

a Runtime type identification or RTTI is a collection of technologies that allows you to identify an item's type at runtime, which is very useful when you deal with runtime polymorphism.
The dynamic cast, typeid operator, and the type_info structure are the three components of RTTI.
Runtime polymorphism has added these items in C++, but that utility comes at a cost.
The dynamic_cast operator is more flexible. For using the dynamic_cast, the instantiation of an object is must. Furthermore, dynamic_cast works only with pointers and references to polymorphic class objects; there must be atleast one virtual function somewhere in the class hierarchy.

No comments: