0
why there is no this in get method encapsulation
2 Réponses
+ 1
WHAT???
0
Because there's no ambiguity. When you use a setter you often use the same name for the parameter as the field. Here you MUST use this.fieldName = fieldName to clarify.
With the getter you could return this.field but it is the same as returning 'field'