2. Object means a real word entity such as pen,
chair, table etc. Object-Oriented Programming is a
methodology or paradigm to design a program
using classes and objects. It simplifies the
software development and maintenance by
providing some concepts:
Object
Class
Inheritance
Polymorphism
Abstraction
Encapsulation
Object-Oriented Programming
3. Encapsulation is one of the fundamentals of
OOP (object-oriented programming). It refers
to the bundling of data with the methods that
operate on that data. Encapsulation is used to
hide the values or state of a structured data
object inside a class.
Encapsulation
4. Encapsulation helps us in binding the
data(instance variables) and the member
functions(that work on the instance variables) of a
class.
Encapsulation is also useful
in hiding the data(instance variables) of a class from
an illegal direct access.
Encapsulation also helps us to make a flexible
code which is easy to change and maintain.
Use of
encapsulation
5. Importance Of Encapsulation
To hide the internal implementation details
of the class
Can safely modified the implementation
without worrying breaking the existing
code that uses the class
Protect class against accidental/ willful
stupidity
Keeps class tidy by keeping the visible
fields to aminimum
Easier to use and understand
6. Benefits of Encapsulation
Provides data hiding
Reusability
Code can be modified without
breaking the code.
Hiding implementation details
reduces complexity.
7. Encapsulation draws a boundary
around a s et of data and
method.
This allows a developer to use the
code without having to know how
it works, but with what input data
and its input data range and with
what it returns.
Maintainability
8. Makes long term development
easy.
Updates can be made by changing
the encapsulated part without
changing the input and output
formats.
Extensibility
9. Encapsulation makes
the code easier to
visualize.
This means codes can be
arranged “visually” before
implementing.
Flexibility