Join Slack
Powered by
I am trying custom delegate in kotlin <https://try...
# getting-started
s
sjthn
06/19/2017, 8:53 AM
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
voddan
06/19/2017, 9:05 AM
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
sjthn
06/19/2017, 9:09 AM
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
Andreas Sinz
06/19/2017, 9:45 AM
@sjthn
yes, you need to store the value inside your Delegate class
s
sjthn
06/19/2017, 9:47 AM
@Andreas Sinz
thanks
4
Views
Open in Slack
Previous
Next