Do we have a concept as publicly or privately inherited in classes in python as we do in c++.
Also I want to ask if there is any concept as public, private and protected members in the python classes.
Do we have a concept as publicly or privately inherited in classes in python as we do in c++.
Also I want to ask if there is any concept as public, private and protected members in the python classes.
Yes , there are public, protected and private access modifiers in python as well similar to c++.
All members in a Python class are public by default.
Python’s convention to make an instance variable protected is to add a prefix _ (single underscore) to it.
Similarly, a double underscore __ prefixed to a variable makes it private.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
Sir can we inherit a whole class protectedly like
class protectedDerived: protected base
{
};
as we do in c++?
and thanks sir for clearing 2nd part of the question.