Something I've always wondered; in a class where you can reference a member by either using 'this.[NAME]' or simply [NAME], which is preferred?
For example in Java:
public class foo {
public int bars = 0;
private void incrementBars(){
bars++;
}
}
and
public class foo {
public int bars = 0;
private void incrementBars(){
this.bars++;
}
}
'seem' to have the same effect.
In cases where I instantiate multiple instances of class foo, I'd, so far, do something like:
for (foo f : listOfFoos){
f.incrementBars();
}
and it seems to still work.
Is it technically ambiguous, and if so is there a preferred way?