mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
21 lines
316 B
Kotlin
Vendored
21 lines
316 B
Kotlin
Vendored
open class A {
|
|
open val a = "OK"
|
|
}
|
|
|
|
class B : A() {
|
|
override val a = "FAIL"
|
|
fun foo() = "CRUSH"
|
|
}
|
|
|
|
class C {
|
|
fun A?.complex(): String {
|
|
if (this is B) return foo()
|
|
else if (this != null) return a
|
|
else return "???"
|
|
}
|
|
|
|
fun bar() = A().complex()
|
|
}
|
|
|
|
fun box() = C().bar()
|