It is the concept of OOPS to handle complexity by hiding unnecessary details from the user.
•In python, we don’t have any keywords like public, private and protected. We don’t have a true mechanism for data hiding in python
•We use (__) to make our members kind of private.
ex: class account:
def __init__(self, balance, name):
self.__balance = balance
return self.__balance #we had used this method to access the data field
Customer = account(0, “Sachin”)
Customer.__balance = 100 #This will not make any change to the value but it will make another variable
It is the ability to leverage the same interface for different underlying forms such as data types or classes.
CREATING POLYMORPHIC CLASSES
We will make two distinct classes to use two distinct objects. Each of these distinct classes needs to have an interface that is in common so that they can be used polymorphically, but we will give them methods that are distinct but that have the same name.