I was wondering if it is possible in C++ to retrieve the name of a class in string form without having to hardcode it into a variable or a getter. I\'m aware that none of th
If you just want to check if it's certain class, then
typeid(obj) == typeid(CSubClass)
will always work regardless of the implementations.
Otherwise, a convenient way is to declare:
virtual const char* classname() { return "CMyClass";}
and implement per subclass.