View Single Post
Re: [C++] Class names
Old
  (#5)
Rick
Council Member
 
Rick's Avatar
 
Status: Offline
Posts: 690
Join Date: Dec 2003
Location: Holland
Default Re: [C++] Class names - 24-08-2005

Quote:
Originally Posted by @$3.1415rin
dynamic cast would cast it, yes, but I want the name of it.

I could of course create a virtual function returning the name, or a member variable being updated. that could of course be optimized by some preprocessor stuff to have less to write. but that's all stuff i'd call too much effort
Well...with dynamic_cast you can see if class X is from type Y. If its not it will return NULL.
Although I'm not sure if it will work on base classes...

I think the best way is(like sfx1999 said) to make a way to 'identify' each class, since dynamic_cast isn't very efficient I believe.
  
Reply With Quote