14 lines
280 B
Kotlin
14 lines
280 B
Kotlin
import kotlin.properties.Delegates
|
|
|
|
class User {
|
|
var name: String by Delegates.observable("<no name>") {
|
|
prop, old, new ->
|
|
println("$old -> $new")
|
|
}
|
|
}
|
|
|
|
fun main(args: Array<String>) {
|
|
val user = User()
|
|
user.name = "first"
|
|
user.name = "second"
|
|
} |