KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is it possible to make a public method private in a subclass? I don't want other classes extending this one to be able to call some of the methods. Here is an example: class A: def __init__(self): #do something here def method(self): #some code here class B(A): def __init__(self): A.__init__(self) #additional initialization goes here def method(self): #this overrides the method ( and possibly make it private here ) From this point forward, I don't want any class that extends from B to be able to call method . Is this possible? A "logical" reason for this is that I don't want users to call methods in the wrong order.
Tags (comma-separated)
Save Edits
Cancel