I'm not quite sure if this is possible so that's why I ask you guys. I want to write a method that knows if it has been visited before and if it has return the same value it has lasttime it were visited. I can't use fields/instance varibles for this.
This is want I want to do, without the instance variable foo:
private FooObject foo = null;
public int setFoo(FooObject in)
{
if(foo == null)
foo = in;
return foo.getX();
}
Could this be done?