You are on page 1of 1

ENCAP:

There are four concepts of OOP .... encapsulation is one of them.


Encapsulation is a technique fo making the fields in a class private and providing access to the fields via
public methods. It also can be described as a protective barrier that prevents the code from being
accessed by other code outside of the class

IMPORTANCE OF ENCAP:
1. To Hide the Implementation detail
2. Protect class against accidental stupidity
3. Keeps class tidy by keeping the visible fields to a minimum
4. Easier to use and understand.

WHY WE NEED:
1. Combining data and how to manipulated in one place.
2. Only allowing the state of an object is to be accessed and modified though behaviors: Like The
values contained within an object’s state can be strictly controlled.
3. Hiding the details of how the object works.

HOW TO DO ENCAPSULATION:
https://www.youtube.com/watch?v=hpRcmfNnwu8

BENEFITS OF ENCAPSULATION
1. Provide data hiding.
2. Reusability
3. Code can be modified without breaking the code.
4. It gives maintainability, flexibility and extensibility to the code.

CONCLUSION
At last, we can say The Encapsulation is so benefitable to modify the implemented code without
breaking the code of others who use the implemented code. THANKS TO ALL....

You might also like