class One get foo as int return 1 class Two get bar as int return 2 class Test shared def main Test().run var _x as Object cue init base.init _x = 0 def run .check(One(), 1) .check(Two(), 2) .checkClassVar def check(obj as Object, value as int) if obj inherits One o as One = obj # assign to a One variable with no casting assert o.foo==value else if obj inherits Two t as Two = obj # assign to a Two variable with no casting assert t.bar==value else throw Exception('fall through') def checkClassVar _x = 1 to Object if _x inherits int _x = 2 assert _x == 2