0% found this document useful (0 votes)
24 views11 pages

Data Encapsulation

Encapsulation is a fundamental concept in object-oriented programming (OOP) that binds together the data and functions that manipulate the data, and that keeps both safe from outside interference and misuse. It enables the selective exposure of objects, with objects exposing a limited set of properties and methods to the external code through access methods like public, private and protected. Encapsulation promotes code reuse, reduces complexity, and improves maintainability and extensibility of software systems.

Uploaded by

nandi121293
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views11 pages

Data Encapsulation

Encapsulation is a fundamental concept in object-oriented programming (OOP) that binds together the data and functions that manipulate the data, and that keeps both safe from outside interference and misuse. It enables the selective exposure of objects, with objects exposing a limited set of properties and methods to the external code through access methods like public, private and protected. Encapsulation promotes code reuse, reduces complexity, and improves maintainability and extensibility of software systems.

Uploaded by

nandi121293
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 11

DATA ENCAPSULATION

1
What are we doing today?

 Introduction of:
 OOPS
 3 IMPORTANT THINGS
 ENCAPSULATION
 ACCESS METHODS
 EXAMPLES

2
OBJECT ORIENTED PROGRAMMING

• It is the expanded version of C.


• It was developed by Bjarne Stroustrup on 1979 initially
called as C with class.
• OOP provides a clear modular structure for programs
which makes it good for defining abstract datatypes where
implementation details are hidden and the unit has a clearly
defined interface.
• OOP makes it easy to maintain and modify existing code
as new objects can be created with small differences to
existing ones
3
OBJECT

• It is an entiy in real world and a


device that support encapsulation.

• Identifying objects and assigning


responsibilities to these objects.
An object is like a
black box.
• Objects communicate to other
The internal objects by sending messages.
details are
hidden. • Messages are received by the
methods of an object

4
THREE IMPORTANT THINGS

• Encapsulation:
Sometimes referred to as data hiding, is the
mechanism whereby the implementation details of a class
are kept hidden from the user.
• Inheritance :
One object acquired the properties of other object.
• Polymorphism:
One interface multiple methods.

5
ENCAPSULATION

• It is the mechanism that binds together code and


data it manipulates,and keeps both safe from outside
interference and misuse.

• When code and data binds together in this fashion


,an object is created.

• It’s the process that allows selective hiding of


properties and methods in class.

6
ACCESS METHODS

• Private:
Objects accessed only inside the class.
• Public:
Objects accessed anywhere in the program.
• Protected:
Methods of the class only can access.

7
Encapsulation into the Protocol Layer

8
ADVANTAGES

• Keeping the state of an object.

• Change the implementation of an object

• Reuse of objects.

• The independence of each object.

9
Example

Student marks
Social Network Account
THANK YOU

11

You might also like