Abstraction & Encapsulation
Abstraction & 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