What Type is a Type?

BlitzMax Forums/BlitzMax Beginners Area/What Type is a Type?

Hi,

Yeah, casting will do it:

Function Process( vehicle:TVehicle )
  If TCar( vehicle )
    'It's a car!
  Else If TBus( vehicle )
    'It's a bus!
  EndIf
End Function


The overhead is pretty minor - in this case it will only have to check 2 superclasses (eg: bus->vehicle->object) at worse to work out if it ISA this or that.

Note that there is not currently a way to determine the 'precise' type of an object - eg: TCar( vehicle ) will return a TCar object if vehicle is of type TCar - OR any type derived from TCar.