Quantcast
Channel: User Filip Milovanović - Software Engineering Stack Exchange
Viewing all articles
Browse latest Browse all 164

Comment by Filip Milovanović on Must getters return values as is?

$
0
0
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.

Viewing all articles
Browse latest Browse all 164

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>