Inheritance in python

The object variables declared in the base class will be copied to the child class object as well. Suppose member is having name defined in init… and now the teacher is inheriting the member class for the object of teacher class will be having a name as the attribute as well.

Also please let me know if there is any concept os access specifiers python like public, private protected.

hey @Akshay986,

yes it will be having it.

Yes there are access specifiers in python.
To do that , we need to name our variables in a different way.
For private it like :
self.__n__ = 15
for protected it is like:
self._n_ = 15
and for public :
self.n=15

The surrounding underscores define there access.

I hope this might have helped you.
Thank You. :slightly_smiling_face: and Happy Learning .