My question is almost like this question Java: calling outer class method in anonymous inner class . But this time we are in Kotlin.
As the example below, I want to call funB() in the object expression, but I only made two failures.
class A { lateinit var funA: () -> Unit lateinit var funB: () -> Unit fun funC() { var b = object : B() { override fun funB() { funA() // A.funA() // Two attempts to fail funB() // b.funB(), not my expect A::funB() // compile error } } } } Thank you for your answer!
[email protected]()