Groovy metaprogramming

Posted by Don on Stack Overflow See other posts from Stack Overflow or by Don
Published on 2010-05-19T10:13:16Z Indexed on 2010/05/19 10:20 UTC
Read the original article Hit count: 221

Filed under:
|

I expect this code fragment to print "ddddd"

String.metaClass.toString = {-> "ddddd" }
"fff".toString()

But it prints "fff", why?

© Stack Overflow or respective owner

Related posts about groovy

Related posts about metaprogramming