Originally Posted by tomjas
Thanks for explanations. So as far as I understand: along with good programming practice I should put private/protected for variables as well as for methods which process these variables, and write separate public method which returns result of these methods (their process - calculations, changing, etc.)? In other words - methods in class should be private/protected so no one can interfere from outside. For these methods should by public methods which returns their result?
No that's not right. The setters and getters should be public if the property can be accessed from outside of this class. You don't need to specify multiple write methods for a single property, just the one is sufficient. If you make everything private or protected, than this class becomes useless outside of itself since you cannot call anything on the object outside of it.