mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
32 lines
489 B
Kotlin
Vendored
32 lines
489 B
Kotlin
Vendored
|
|
// FILE: Base.java
|
|
|
|
public interface Base {
|
|
String getValue();
|
|
|
|
default String test() {
|
|
return getValue();
|
|
}
|
|
}
|
|
|
|
// FILE: main.kt
|
|
|
|
public interface BaseKotlin : Base {
|
|
override fun getValue() = "OK"
|
|
|
|
override fun test(): String {
|
|
return getValue();
|
|
}
|
|
}
|
|
|
|
class OK : BaseKotlin {
|
|
override fun getValue() = "OK"
|
|
}
|
|
|
|
fun box(): String {
|
|
val ok = object : BaseKotlin by OK() {
|
|
override fun getValue() = "Fail"
|
|
}
|
|
return ok.test()
|
|
}
|