0% found this document useful (0 votes)
46 views

Abstraction & Encapsulation

Encapsulation wraps data and methods together to protect them from accidental modification. Abstraction hides implementation details and allows subclasses to inherit functionality through abstract classes, avoiding unnecessary exposure while enabling robust code reuse through interfaces.

Uploaded by

Rajath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Abstraction & Encapsulation

Encapsulation wraps data and methods together to protect them from accidental modification. Abstraction hides implementation details and allows subclasses to inherit functionality through abstract classes, avoiding unnecessary exposure while enabling robust code reuse through interfaces.

Uploaded by

Rajath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

ENCAPSULATION &

ABSTRACTION
ENCAPSULATION
It is the concept of wrapping data and methods
needed for the data in a unit. Encapsulation puts a
barrier on modifications that can be accidentally
done to a program. The only way to change an
object variable is to change the object method.
Example for a Program with Protected Members
Example for a Program with Private Members
ABSTRACTION
It is the process of hiding the implementation
of a program by using abstract classes. This
helps in the usage of a parent class in a child
class and robustly implements the code. It can
be used to create an Application Program
Interface (API). Unnecessary data can be
avoided from being shown to the user if
abstract classes are used.
Example for a Program with Abstract Class
REFERENCE
https://www.geeksforgeeks.org/encapsulation-in-python/
https://www.geeksforgeeks.org/abstract-classes-in-python/
THANK YOU

You might also like