Get Class Name of object instance
Monkey Forums/Monkey Programming/Get Class Name of object instance| 
 | ||
| Hi! Is it possible with the reflection module to get the class name of an instance of an object during runtime? | 
| 
 | ||
| yes I think its just as simple as: local myobj:tree Print GetClass(myobj).Name (prints "tree") | 
| 
 | ||
| Ah, missed that. Thanks ;) | 
| 
 | ||
| Hmmm, the example didn't work over here: I've tried it and it prints out: monkey.lang.Object | 
| 
 | ||
| Because in that sample code, myobj is still null. You need to assign it an instance of tree. | 
| 
 | ||
| Doesnt work either. | 
| 
 | ||
| did you import reflection? | 
| 
 | ||
| Hi, This works here: Import reflection Class C End Function Main() Local c:=New C Print GetClass( c ).Name End | 
| 
 | ||
| Oh thanks, I had setup a wrong reflection filter. I'm sorry, but thanks for the help anyway ;) |