0
Are getters and setters evil???
So I was talking to someone today and they were telling me that getters and setters are usually to be avoided if possible because it contradicts the principal of oop which is to hide implementation of objects which I get. I’m just curious as to how you guys go about doing that. I’m kind of stuck as to how to put this principal into practice.
3 ответов
+ 4
its called encapsulation its to keep your class fields private
+ 3
0
「HAPPY TO HELP」 ahhhh I think I follow. So are saying that get methods and set methods are ok sometimes if the name is soecific but caution is needed because it could possibly cause a sode effect where a child is modifying the parents attributes?