What is RTTI?

Runtime type identification (RTTI) lets you find the dynamic type of an object when you have only a pointer or a reference to the base type. RTTI is the official way in standard C++ to discover the type of an object and to convert the type of a pointer or reference (that is, dynamic typing). The need came from practical experience with C++. RTTI replaces many homegrown versions with a solid, consistent approach.  

Showing Answers 1 - 2 of 2 Answers

swarn kant

  • Mar 14th, 2006
 

RTTI stands  for the Run Time Type Identification.

Operator dynamic_cast is used in RTTI.It cast a derieved class object into base class and vice versa at run time.

base b1;

derieved d1;

if(b1 == dynamic_cast <base> (d1))

.....................

else

..................

  Was this answer useful?  Yes

Srilekha

  • May 23rd, 2007
 

We can only assign a derived object to a base object pointer and a base class member to a derived class member pointer.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions