Abstraction and Encapsulation
Abstraction and Encapsulation
- The notion of a class represents software engineering principles and lessons learned from structured methods
- A class consists of two parts
- The interface part, that can be seen and used by other entities in the system
- The implementation part, that is hidden from the rest of the system
- Hiding the implementation details of a class/object is called information hiding or encapsulation
- Encapsulation offers two kinds of protection
- It protects an object’s internal state from corruption by its clients
- It protects client code from being affected by changes to the internal representation and/or implementation of an object