Can I pass an overloaded function as a parameter t...
# getting-started
a
Can I pass an overloaded function as a parameter to another? Eg.,
Copy code
class Foo {
    fun bar(p1: Int)
    fun bar(p2: String)
}
Is it possible to reference one of the
bar()
overloads as a function argument?
k
It should pick the correct one automatically, but you can always force it with a variable assignment, eg
Copy code
val ref: (Int) -> Unit = ::bar
foo(ref)
a
Thanks!