mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
23 lines
330 B
Kotlin
Vendored
23 lines
330 B
Kotlin
Vendored
// FILE: Base.java
|
|
|
|
public interface Base {
|
|
String getValue();
|
|
|
|
default String test() {
|
|
return getValue();
|
|
}
|
|
}
|
|
|
|
// FILE: main.kt
|
|
class Fail : Base {
|
|
override fun getValue() = "Fail"
|
|
}
|
|
|
|
class Derived : Base by Fail() {
|
|
override fun getValue() = "OK"
|
|
}
|
|
|
|
fun box(): String {
|
|
return Derived().test()
|
|
}
|