"MoCha" <mo**************@rediffmail.com> wrote in message
news:7d**************************@posting.google.c om...
| i want to get the name of the class of an object during run-time. the
| problem is when i'm using the rtti mechanism of name(), the name is
| preceded by the length. So, i get something like 3abc (instead of
| abc).
| could someone shed some light on this.
The string returned by a typeid's name() member function is
implementation-defined. It could embed information about the
namespace that contains the class in various ways,
and any other information.
So you have two choices with the current C++ standard:
- Use rtti, and unmangle the returned string in
a platform-specific way.
- Add a virtual function to your class, which will
return a name that you can define as needed.
Regards,
Ivan
--
http://ivan.vecerina.com