title: kotlin delegate property ,In a get() method how i can access the value?
body: <p>Kotlin has delegated properties which is a very nice feature. But I am figuring out how to get and set the values. Let's say I want to get value of the property which is delegated.  In a get() method how i can access the value? </p>
  
  <p>Here's an example of how I have implemented:</p>
  
  <pre><code>class Example() {
      var p: String by DelegateExample()
  }
  class DelegateExample {
      operator fun getValue(thisRef: Any?, property: KProperty&lt;*&gt;): String {
          return "${property.name} "
      }
  
    operator fun setValue(thisRef: Any?, property: KProperty&lt;*&gt;, value: String) {
      println("${value.trim()} '${property.name.toUpperCase()} '")
     }
  }
  fun delegate(): String {
      val e = Example()
      e.p = "NEW"
      return e.p
  }
  </code></pre>
  
  <p>The main question I am unable to understand is, How can I set the value to the actual property on which the delegation class is assigned. When I assign "NEW" to property <code>p</code>, how can I store that value to the variable <code>p</code> or read that new value passed on to <code>p</code> with get? Am I missing something basic here? Any help will be much appreciated. Thanks in advance.</p>