New course! Every coder should learn Generative AI!
Try a free lesson0
So... um... GETTER and SETTER are just public methods, what contain possibility to modify and show us private variables?
right? and why can't we just give to those methods abother names?
1 Answer
0
Yes... They allow you to access private class members, and if you wanted to, you could name them however you want, but the convention is to name them getVariableName and setVariableName.