I was hoping that the class method is treated as a...
# getting-started
d
I was hoping that the class method is treated as a function and can be passed to the higher-order function by name without any problem. But it’s not
Copy code
class Foo {
  fun id(x: Int): Int = x

  fun call() {
    arrayOf(1, 2, 3).map(id)        //compilation error
    arrayOf(1, 2, 3).map { id(it) } // ok
  }
}