In C++ you can disable a function in parent’s class by declaring it as private in the child class. How can this be done in Python? I.E. How can I hide parent’s function from child’s public interface?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There really aren’t any true ‘private’ attributes or methods in Python. One thing you can do is simply override the method you don’t want in the subclass, and raise an exception: