Classes are containers for variables and the operations (methods) that will affect the variables. As we discussed earlier, as ADTs implement encapsulation techniques for grouping all similar data and functions into a group, the classes can also be applied to group them. A class has three access control sections for wrapping the data and methods, and they are:
- Public: Data and methods can be accessed by any user of the class
- Protected: Data and methods can only be accessed by class methods, derived classes, and friends
- Private: Data and methods can only be accessed by class methods and friends
Let's go back to the definition of abstraction and information hiding in the previous section. We ...