Referencing type in a variable

BlitzMax Forums/BlitzMax Programming/Referencing type in a variable

Mauft(Posted 2009) [#1]
Is it possible to reference a Type in a variable and then use this variable to create instances of said type, like in Actionscript? Something like this:
Type TPizza EndType
Local TPizzaHolder:Type=TPizza
Local newPizza:TPizza=new TPizzaHolder

This obviously doesn't work, throws an error about using Type when expecting identifier. Whether I change it to Object or TPizza the result is still the same, so my guess is it isn't possible, but there is no harm in asking I guess.


beanage(Posted 2009) [#2]
Theres the TTypeID class from the reflection mod:

Type TPizza EndType
Local pizzatype:TTypeID = TTypeID.ForName( "TPizza" )
Local newpizza:Object = pizzatype.NewObject()