Sureshot324
Diamond Member
A lot of programmers seem to be of the opinion that it is good programming style to NEVER make fields of an object public. They should always be private and there should be get/set methods for them if access outside the object is required.
Why is this? I understand if security is a concern and you want to prevent outside write access or something, but for 99% of variables were it really doesn't matter, why not keep it simple and just make them public?
Why is this? I understand if security is a concern and you want to prevent outside write access or something, but for 99% of variables were it really doesn't matter, why not keep it simple and just make them public?