Issue
What is the Kotlin equivalent of Java's OuterClass.super.method()
?
Example (in Java):
class Outer {
class Inner {
void someMethod() {
Outer.super.someOtherMethod();
}
}
@Override
public String someOtherMethod() {
// This is not called...
}
}
Solution
Use the [email protected]()
syntax:
open class C {
open fun f() { println("C.f()") }
}
class D : C() {
override fun f() { println("D.f()") }
inner class X {
fun g() {
[email protected]() // <- here
}
}
}
This is similar to how Java OuterClass.this
is expressed in Kotlin as this@OuterClass
.
Answered By - hotkey
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.