private var readWrite: Int by resourceDelegate()
fun resourceDelegate(): ReadWriteProperty<Any?, Int> =
object : ReadWriteProperty<Any?, Int> {
var curValue = 0
override fun getValue(thisRef: Any?, property: KProperty<*>): Int = curValue
override fun setValue(thisRef: Any?, property: KProperty<*>, value: Int) {
println("Setting value using resource delegate")
curValue = value
}
}
init {
readWrite = 4
}