RosettaCodeData/Task/Add-a-variable-to-a-class-instance-at-runtime/Groovy/add-a-variable-to-a-class-instance-at-runtime-1.groovy
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

6 lines
170 B
Groovy

class A {
final x = { it + 25 }
private map = new HashMap()
Object get(String key) { map[key] }
void set(String key, Object value) { map[key] = value }
}