General Type Creator

BlitzMax Forums/BlitzMax Programming/General Type Creator

Hardcoal(Posted 2012) [#1]
Hi. Is it possible to make a function that will create a Type by demand.
lets say i have 3 types and I want one function to create it

Type Car_Type
End Type

Type Plane_Type
End Type

Type Skate_Type
End Type

Function CreateType(Type_Type=Car_Type)
End Funcion

Lets say i have hounderds of types..
is there a way for that?


Derron(Posted 2012) [#2]
Only with casting and reflection

Function CreateType:object(type:string)
'reflectionstuff
'...
return newobject
End Function

local ObjA:TObjA = TObjA(CreateType("ObjA")


bye
Ron


Hardcoal(Posted 2012) [#3]
I dont know what casting and reflaction are but i found another way..

Last edited 2012