Easiest way to get the object type of an instance?

BlitzMax Forums/BlitzMax Beginners Area/Easiest way to get the object type of an instance?

Schwang(Posted 2010) [#1]
Assuming I have an indefinite number of extended classes, ultimately I want an independant function I could use globally that takes an object instance as a parameter and returns its object type, i.e. whatever class it was instantiated from.

Is there a simple solution?


BladeRunner(Posted 2010) [#2]
See reflection for this:

TID = TTypeID.forObject(myobject)
print TID.name()



Schwang(Posted 2010) [#3]
Oh excellent, this is really useful! This way I can either discover which class an instance is from, or compare it to classes I know about to see if it is of that class type.



Many thanks Bladerunner.