benleggiero
02/08/2017, 4:42 AMThis
that can be used to say "The parameter's type is the sub- or implementing-class' type"
So:
interface Foo<T> {
fun example(other: This): T
}
class Bar: Foo<Int> {
fun example(other: Bar): Int {
TODO()
}
}
class Baz<T>: Foo<T> {
fun example(other: Foo<T>): T { // Old style gets a compile error: must be Baz or a subclass of Baz
TODO()
}
}