Please see my other Web Development articles.
Leveraging Encapsulation to Protecting Data & Behavior
As demonstrated in my Inheritance article, I designed an Employee class which serves as a parent class for the Supervisor class.
As you can see, the Employee class contains data and behaviors common to all types of employees, which the Supervisor class reuses in its objects.
Code reuse is just one reason for defining elements common to all child objects in a parent class.
Hiding the contents of a class when possible provides better security and a standard API for code use.
Encapsulation demonstrates this characteristics by limiting access to data using the private keyword and exposing special methods which directly access data in a safe and predefined manner.