mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-18 00:21:35 +00:00
15 lines
210 B
Kotlin
Vendored
15 lines
210 B
Kotlin
Vendored
import kotlin.reflect.KProperty
|
|
|
|
class Delegate {
|
|
fun getValue(t: A, p: KProperty<*>): Int = 1
|
|
}
|
|
|
|
val A.prop: Int by Delegate()
|
|
|
|
class A {
|
|
}
|
|
|
|
fun box(): String {
|
|
return if(A().prop == 1) "OK" else "fail"
|
|
}
|