1) Encapsulation - data hiding, private fields, getters and setters
2) Encapsulation - benifit? stops other people from breaking code - users of the class. Allows class writes to change the private algos on the data/class and not break other code. (unless we mess the logic/data)
A way to restrict access to an object components
A way to aggregate copmplaex stuff and provide a simple interface to a user of a class/object
No comments:
Post a Comment