class A function f(x) return x + 1 (function(obj) -> obj.f(1))(new A) class B function g(f) return f(1) (new B).g(function(x) -> x + 1)