class Test shared var _tookCar = 0 var _tookBus = 0 def main x as dynamic = Car() if x inherits Car .takeCar(x) if x inherits Bus .takeBus(x) assert _tookCar == 1 assert _tookBus == 0 def takeCar(c as Car) _tookCar += 1 def takeBus(b as Bus) _tookBus += 1 class Car pass class Bus pass