Well, simple question: why this code does not compile ??
open class A
class B: A()
fun main(args: Array<String>) {
var f: (A) -> Boolean = { arg: B -> false }
}
?
what’s problem if I pass B() to “(A) -> Boolean” function ?
Well, simple question: why this code does not compile ??
open class A
class B: A()
fun main(args: Array<String>) {
var f: (A) -> Boolean = { arg: B -> false }
}
?
what’s problem if I pass B() to “(A) -> Boolean” function ?
If this code compiled, I could create a `class C: A` and pass it to your lambda, which would then try to cast it to a `B` and crash.
Oh. Thanks.