How to call outer class' super method from inner class in Kotlin? -
what kotlin equivalent of java's outerclass.super.method()
?
example (in java):
class outer { class inner { void somemethod() { outer.super.someothermethod(); } } @override public string someothermethod() { // not called... } }
use super@outerclass.method()
syntax:
open class c { open fun f() { println("c.f()") } } class d : c() { override fun f() { println("d.f()") } inner class x { fun g() { super@d.f() // <- here } } }
this similar how java outerclass.this
expressed in kotlin this@outerclass
.
Comments
Post a Comment