SlideShare a Scribd company logo
By The Department of
Computer Science & Engineering
Patel college of science and technology
Submitted By :--
• Vinit Singh Pathir
• Anshu Prajapat
Submitted To :--
Mr.Vikas Kalme Sir
Session 2023-24
Topic
 Introduction
 What is Encapsulation?
 Real Life example of
Encapsulation
 Advantages of Encapsulations
 Important to know
 Example of Encapsulation in
C++
 Types Of Encapsulation
 Why we use Encapsulation?
Introduction to
Encapsulation
Introduction
Encapsulation means binding
(joining) a variables (data)
with a function (Methods).
Introduction
Encapsulation means binding
(joining) a variables (data)
with a function (Methods).
E.g. When we encapsulate a
class
Introduction
Encapsulation means binding
(joining) a variables (data)
with a function (Methods).
 It keep the important but
unnecessary data away
from the user of the
program
E.g. When we encapsulate a
class
Encapsulation in C++
Encapsulation in C++ is defined as
the wrapping up of data and
information in a single unit.
What is Encapsulation in C++?
In Object Oriented Programming
(OOP),
Encapsulation is defined as binding
together the data and the functions
that manipulate them.
Real life example of
Encapsulation
Real Life Practical example of Encapsulation
As we know ,in a company, there are different sections like the accounts
section, finance section, sales section, etc.
The finance section handles all the financial transactions and keeps
records of all the data related to finance.
Similarly, the sales section handles all the sales-related activities and
keeps records of all the sales.
Now there may arise a situation when for some reason an official from
the finance section needs all the data about sales in a particular month.
In this case, he is not allowed to directly access the data of the sales
section. He will first have to contact some other officer in the sales section
and then request him to give the particular data.
This is what encapsulation means our computer programming
Why we need to
use
Encapsulation ?
Why we need to use Encapsulation ?
Encapsulation is a way to restrict the direct access
to some components of an object, so users cannot
access state values for all of the variables of a
particular object.
Encapsulation can be used to hide both data members
and data functions or methods associated with an
instantiated class or object.
The primary purpose of encapsulation is to hide an
object’s internal representation or state from the
outside. This concept is also known as information
hiding.
Advantages
Of
Encapsulate
Advantages of Encapsulations
Data Hiding : Restricts access to data
members, hiding
implementation details.
Control : Provides better control over class
attributes and methods.
Security: Increases security of data.
Flexibility: Allows changes to one part of
the code without
affecting
others.
Reusability: By defining one class, we can
create many objects
with consistent
behavior.
Types
Of
Encapsulate
Types Of Encapsulation
• There are three basic types Encapsulation
 Member variable encapsulation,
 Function encapsulation and
 Class encapsulation
Encapsulation
Member
variable
encapsulati
-on
Function
encapsulati
-on
Class
encapsulati
-on
Member Variable
Encapsulation
Member Variable Encapsulation:
 In this type, data
members (also
known as
attributes or
fields) are
encapsulated
within a class.
Member Variable Encapsulation:
 Data members
are typically
private by
default, ensuring
that they are not
directly
accessible from
outside the class.
 In this type, data
members (also
known as
attributes or
fields) are
encapsulated
within a class.
Member Variable Encapsulation:
 Data members
are typically
private by
default, ensuring
that they are not
directly
accessible from
outside the class.
 To access these
data members,
we use setter and
getter methods
(also known as
mutator and
accessor
methods).
 In this type, data
members (also
known as
attributes or
fields) are
encapsulated
within a class.
Function
Encapsulation
Function Encapsulation:
 Function
encapsulation
refers to
marking a
method of code
as private to
prevent
unauthorized
access.
Function Encapsulation:
 Function
encapsulation
refers to
marking a
method of code
as private to
prevent
unauthorized
access.
 These private
methods are
hidden from
external code.
Function Encapsulation:
 Function
encapsulation
refers to
marking a
method of code
as private to
prevent
unauthorized
access.
 These private
methods are
hidden from
external code.
 It ensures that
only
authorized
parts of the
code can call
specific
functions.
Class
Encapsulation
 Class Encapsulation:
 Class
encapsulation
involves
declaring an
entire class as
private to
restrict user
access.
 Class Encapsulation:
 Class
encapsulation
involves
declaring an
entire class as
private to
restrict user
access.
 This means
that other
classes cannot
directly
interact with
the
encapsulated
class.
 Class Encapsulation:
 Class
encapsulation
involves
declaring an
entire class as
private to
restrict user
access.
 It allows hiding
implementatio
n details and
organizing
related data
and methods
together.
 This means
that other
classes cannot
directly
interact with
the
encapsulated
class.
Example of
Encapsulation in C++
Example of Encapsulation in C++
In this example:
 We calculate the area of a rectangle using the
getArea() method.
 The length and breadth data members are
private, encapsulating them within the
Rectangle class.
 The public interface allows access to the
getArea() method.
Important to know
Encapsulation is counted as one in four main pillar Of
Object Oriented Programming (OOPs)
Additional Notes:
 Getter and setter functions provide
controlled access to class members.
 Encapsulation is not just data hiding;
it’s about bundling related fields and
methods together.
 It improves readability,
maintainability, and security.
Thank
You

More Related Content

PPTX
Prese00yq3whesfthewgdsyuvferwyjhjdfegcyjgfz.pptx
PPTX
Presen5416846534653416354165341864adeadvdes
PPTX
Prese00z213hfcyudegtyfwyyudeqw7tgfi7u.pptx
PPTX
Presentation - Copy no vaperpoit asd.pptx
PPTX
Module 4 Effect of Reuse on using Encapsulation.pptx
PPTX
Presentation - 001jasfcjedhfuj5454545.pptx
PPTX
Encapsulation
PPTX
[OOP - Lec 08] Encapsulation (Information Hiding)
Prese00yq3whesfthewgdsyuvferwyjhjdfegcyjgfz.pptx
Presen5416846534653416354165341864adeadvdes
Prese00z213hfcyudegtyfwyyudeqw7tgfi7u.pptx
Presentation - Copy no vaperpoit asd.pptx
Module 4 Effect of Reuse on using Encapsulation.pptx
Presentation - 001jasfcjedhfuj5454545.pptx
Encapsulation
[OOP - Lec 08] Encapsulation (Information Hiding)

Similar to Presentation related to Encapsulation and OOPs (20)

PPTX
Encapsulation C++ Piller of OOP it is the important piller
PPTX
Encapsulation C++ Piller of OOP it is the important piller
PPTX
ENCAPSULATION module for IT or comsci.pptx
PPTX
Encapsulation and inheritance
PPTX
cryptography
PPTX
004_Private and public attributes and methods.pptx
PPT
Synapseindia strcture of dotnet development part 1
PPTX
encapsulation
PPT
C++Presentation 2.PPT
PPTX
Python-Encapsulation.pptx
PDF
Chapter2 Encapsulation (Java)
PPTX
OOP presentation.pptx
PDF
4 pillars of OOPS CONCEPT
PDF
Lecture 2 cst 205-281 oop
PPTX
OOSD Lecture 1-1.pptx FOR ENGINEERING STUDENTS
PPTX
Encapsulation
DOCX
Object oriented basics
PPTX
Introduction to OOPs second year cse.pptx
PPTX
Abstraction file
Encapsulation C++ Piller of OOP it is the important piller
Encapsulation C++ Piller of OOP it is the important piller
ENCAPSULATION module for IT or comsci.pptx
Encapsulation and inheritance
cryptography
004_Private and public attributes and methods.pptx
Synapseindia strcture of dotnet development part 1
encapsulation
C++Presentation 2.PPT
Python-Encapsulation.pptx
Chapter2 Encapsulation (Java)
OOP presentation.pptx
4 pillars of OOPS CONCEPT
Lecture 2 cst 205-281 oop
OOSD Lecture 1-1.pptx FOR ENGINEERING STUDENTS
Encapsulation
Object oriented basics
Introduction to OOPs second year cse.pptx
Abstraction file
Ad

Recently uploaded (20)

PPTX
Spectroscopy.pptx food analysis technology
PDF
cuic standard and advanced reporting.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Empathic Computing: Creating Shared Understanding
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Approach and Philosophy of On baking technology
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Spectroscopy.pptx food analysis technology
cuic standard and advanced reporting.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Diabetes mellitus diagnosis method based random forest with bat algorithm
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Unlocking AI with Model Context Protocol (MCP)
Empathic Computing: Creating Shared Understanding
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
20250228 LYD VKU AI Blended-Learning.pptx
Programs and apps: productivity, graphics, security and other tools
Mobile App Security Testing_ A Comprehensive Guide.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
MIND Revenue Release Quarter 2 2025 Press Release
Approach and Philosophy of On baking technology
Digital-Transformation-Roadmap-for-Companies.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Ad

Presentation related to Encapsulation and OOPs

  • 1. By The Department of Computer Science & Engineering Patel college of science and technology Submitted By :-- • Vinit Singh Pathir • Anshu Prajapat Submitted To :-- Mr.Vikas Kalme Sir Session 2023-24
  • 2. Topic  Introduction  What is Encapsulation?  Real Life example of Encapsulation  Advantages of Encapsulations  Important to know  Example of Encapsulation in C++  Types Of Encapsulation  Why we use Encapsulation?
  • 4. Introduction Encapsulation means binding (joining) a variables (data) with a function (Methods).
  • 5. Introduction Encapsulation means binding (joining) a variables (data) with a function (Methods). E.g. When we encapsulate a class
  • 6. Introduction Encapsulation means binding (joining) a variables (data) with a function (Methods).  It keep the important but unnecessary data away from the user of the program E.g. When we encapsulate a class
  • 8. Encapsulation in C++ is defined as the wrapping up of data and information in a single unit. What is Encapsulation in C++? In Object Oriented Programming (OOP), Encapsulation is defined as binding together the data and the functions that manipulate them.
  • 9. Real life example of Encapsulation
  • 10. Real Life Practical example of Encapsulation As we know ,in a company, there are different sections like the accounts section, finance section, sales section, etc. The finance section handles all the financial transactions and keeps records of all the data related to finance. Similarly, the sales section handles all the sales-related activities and keeps records of all the sales. Now there may arise a situation when for some reason an official from the finance section needs all the data about sales in a particular month. In this case, he is not allowed to directly access the data of the sales section. He will first have to contact some other officer in the sales section and then request him to give the particular data. This is what encapsulation means our computer programming
  • 11. Why we need to use Encapsulation ?
  • 12. Why we need to use Encapsulation ? Encapsulation is a way to restrict the direct access to some components of an object, so users cannot access state values for all of the variables of a particular object. Encapsulation can be used to hide both data members and data functions or methods associated with an instantiated class or object. The primary purpose of encapsulation is to hide an object’s internal representation or state from the outside. This concept is also known as information hiding.
  • 14. Advantages of Encapsulations Data Hiding : Restricts access to data members, hiding implementation details. Control : Provides better control over class attributes and methods. Security: Increases security of data. Flexibility: Allows changes to one part of the code without affecting others. Reusability: By defining one class, we can create many objects with consistent behavior.
  • 16. Types Of Encapsulation • There are three basic types Encapsulation  Member variable encapsulation,  Function encapsulation and  Class encapsulation Encapsulation Member variable encapsulati -on Function encapsulati -on Class encapsulati -on
  • 18. Member Variable Encapsulation:  In this type, data members (also known as attributes or fields) are encapsulated within a class.
  • 19. Member Variable Encapsulation:  Data members are typically private by default, ensuring that they are not directly accessible from outside the class.  In this type, data members (also known as attributes or fields) are encapsulated within a class.
  • 20. Member Variable Encapsulation:  Data members are typically private by default, ensuring that they are not directly accessible from outside the class.  To access these data members, we use setter and getter methods (also known as mutator and accessor methods).  In this type, data members (also known as attributes or fields) are encapsulated within a class.
  • 22. Function Encapsulation:  Function encapsulation refers to marking a method of code as private to prevent unauthorized access.
  • 23. Function Encapsulation:  Function encapsulation refers to marking a method of code as private to prevent unauthorized access.  These private methods are hidden from external code.
  • 24. Function Encapsulation:  Function encapsulation refers to marking a method of code as private to prevent unauthorized access.  These private methods are hidden from external code.  It ensures that only authorized parts of the code can call specific functions.
  • 26.  Class Encapsulation:  Class encapsulation involves declaring an entire class as private to restrict user access.
  • 27.  Class Encapsulation:  Class encapsulation involves declaring an entire class as private to restrict user access.  This means that other classes cannot directly interact with the encapsulated class.
  • 28.  Class Encapsulation:  Class encapsulation involves declaring an entire class as private to restrict user access.  It allows hiding implementatio n details and organizing related data and methods together.  This means that other classes cannot directly interact with the encapsulated class.
  • 30. Example of Encapsulation in C++ In this example:  We calculate the area of a rectangle using the getArea() method.  The length and breadth data members are private, encapsulating them within the Rectangle class.  The public interface allows access to the getArea() method.
  • 32. Encapsulation is counted as one in four main pillar Of Object Oriented Programming (OOPs)
  • 33. Additional Notes:  Getter and setter functions provide controlled access to class members.  Encapsulation is not just data hiding; it’s about bundling related fields and methods together.  It improves readability, maintainability, and security.