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: 241
groovy
|metaprogramming
I expect this code fragment to print "ddddd"
String.metaClass.toString = {-> "ddddd" }
"fff".toString()
But it prints "fff", why?
© Stack Overflow or respective owner