1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
class A { method(arg) { print "A.method(" + arg + ")"; } } class B < A { getClosure() { return super.method; } method(arg) { print "B.method(" + arg + ")"; } } var closure = B().getClosure(); closure("arg"); // expect: A.method(arg)