property delegate enable you get or set a property value
by DelegateObject.getValue or DelegateObject.setValue
in this way, Delegate object can be reused in similar places
Sources
fun main() {
val hello = Hello()
hello.name = "tom"
println(hello.name)
}
class Hello {
var name: String by Delegate()
}
class Delegate {
private var value = ""
operator fun getValue(thisRef: Any, property: KProperty<*>): String {