Encapsulation is a mechanism that associates
data and a
code into a
single unit and keep them safe
from misuse and external interference . In this process
focus is on
hiding non-essential parts and concentrating
on the essential parts of the class .
Some other common definitions are :
1. When an objects state and behavior are kept together they are encapsulated.
2. The wrapping up of data and function into a single unit is known as data encapsulation .