Page 1 of 1

What is a “RTTI”?

Posted: Tue Feb 01, 2011 6:49 am
by mkar
Hello, I am an BE student and i have passed the exam of CPP subject that is my favorite and always try to learn new. I got a new word RTTI in a book but still didn't clear exactly what is? So Can you?

Re: What is a “RTTI”?

Posted: Tue Feb 01, 2011 10:09 pm
by BenBowen
Sorry, doesn't ring a bell. But fortunately, I use the internet a bit more carefully!

Behold:
http://en.wikipedia.org/wiki/RTTI

Re: What is a “RTTI”?

Posted: Wed Feb 02, 2011 6:45 pm
by Andyhhp
Run Time Type Identification. It is extra metadata put into each class definiton which contains the name of that class in the source code (amongst other things).

Personally, I dont find it too useful. It is designed for a base class to be able to interigate a pointer it has, and work out which subclass that pointer is.

However, that defeats the purpose of having a base class in the first place, meaning the code is probably not being written in a sensible fashon.

It does however aid debugging with the object itself storing its name, rather than the debugger having to keep track of the extra metadata in the symbol table.

~Andrew