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?
| ||
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? |
| ||
See reflection for this:TID = TTypeID.forObject(myobject) print TID.name() |
| ||
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. |