Groovy web console

subscribe to the feed Subscribe
to this
site
trait example (via #groovywebconsole)
tweet this snippet Tweet
this
script

trait example

Published 2 weeks ago by AS with tags traits
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
trait Tra {
   Object hello(String a = 'hello') {
     a
   }
}

class Cl implements Tra {
  @Override
  Object hello() {
     return "${super.hello()} with no args"
  }
}

def a = new Cl()
println a.hello()
println a.hello("else")