I am trying custom delegate in kotlin <https://try...
# getting-started
s
I am trying custom delegate in kotlin https://try.kotlinlang.org/#/Examples/Delegated%20properties/Custom%20delegate/Custom%20delegate.kt How can i get the value of the variable from within the delegate class?
v
sjthn: If you delegated a property to an object, then is't the objects responsibility to keep the value. In other words, there is no
field
when delegating, because you have to implement it yourself if you need to.
s
so if i want to override the value of that object inside the delegate class, i should create a field and make changes on it, right?
a
@sjthn yes, you need to store the value inside your Delegate class
s
@Andreas Sinz thanks