What’s wrong with this Groovy code?
class Pretending {
public int count=0
Object get(String name)
{
return 'hi'
}
void set(String name, Object value)
{
count++;
}
def anto = new Pretending();
Here I’m trying to extend the functionality of Groovy set/get method, but when I try to execute this script by groovy Pret (where my file name is Pret), I’m getting an error on the last line stating unexpected token. What’s the reason for this? I’m a newbie to the Groovy world, so I wasn’t able to figure it out!
i think this is what you are trying to achieve + extras