can a class display its name?

This is a discussion on can a class display its name? within the C++ Programming forums, part of the General Programming Boards category; Is there a way to have a class display its name (i.e. base) without setting a varible to it's name? ...

I believe you can get it with RTTI, though the syntax for structure with that data has escaped my memory.

Why do you want this name though? Is it for use with inheritance issues? If so, there are likely better ways of dealing with your problems (RTTI is rather slow), but we'd need to know more about the problem to come up with a solution.

That's what RTTI is for, with RTTI enabled, class names, etc are placed into your EXE file as you have typed them into your program - eg. MyClass, or MySuperLongClassName. Then you can use the typeinfo stuff for retrieving class names, etc.

RTTI stands for Run Time Type Information I believe. I only ever use it for the "dynamic_cast" operator.