[gameprogrammer] Re: detecting class type at runtime

  • From: Matthew Weigel <unique@xxxxxxxxxxx>
  • To: <gameprogrammer@xxxxxxxxxxxxx>
  • Date: Wed, 18 Apr 2012 08:59:01 -0500

On 18.04.2012 08:36, Jonathan Dearborn wrote:

C++ does not have true reflection capabilities. However, you can use RTTI
in the form of dynamic_cast:

It doesn't have true reflection, but you can go a little further than dynamic cast and actually use the typeid operator.

A basic example of getting at the name of a class is here: http://msdn.microsoft.com/en-us/library/fyf39xec.aspx

(Note that for some things, you can use type_info::hash_code to be a little more efficient)
--
 Matthew Weigel
 hacker
 unique & idempot . ent

---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: