title: How to override fields in groovy
body: <pre><code>class A {
      def p = 18
      def out() {
          println(p)
      }
  }
  class B extends A {
      def p = 21
  }
  
  new B().out()
  </code></pre>
  
  <p>I have the snippet as above. The output is <code>****</code>.. Guess what?</p>
  
  <p>My question is - how can I achieve results as it would be in java? </p>
  
  <p><em>ps: groovy console works fine for those who wants execute sample above: groovyconsole.appspot.com</em> </p>
  
  <p><strong><em>UPD</em> :</strong>
  transforming property to method solves issue. any other options?</p>