Encapsulation helps - Encapsulation

Q.  Encapsulation helps
- Published on 19 Oct 15

a. information hiding
b. in providing low coupling
c. in providing high cohesion
d. All the above

ANSWER: All the above
Encapsulation works on providing interactions through function calling only. Using keyword private or protected stops the use of data members outside class. The data thus remains accessible to functions inside class. Encapsulation is also called information hiding as it restricts the use of data inside class. Coupling is the degree of interdependence between different blocks( modules) of program code. Low coupling helps in keeping data safe inside the class. Coupling contrasts cohesion as with high cohesion comes reliability and reusability in a code.

Post your comment / Share knowledge

Enter the code shown above:
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)