A getter is a part of the public interface of a class. The public interface defines how the class communicates with the outside world, allowing you to change the underlying (internal) representation if you have a reason to. A getter is no different in that regard - the value you return is the value that's meant to be visible to the outside, it doesn't need to be exactly the same as the underlying field (or a combination of fields); it can also be computed without there being a corresponding field.
↧