mardi 12 février 2019

Python - Need to block some of the methods from the parent class

I have a Base class with all the common methods. How can I select only the selected methods from this base class and build a child class?

I am not sure how can I make only the required methods available in the child class.

Sample code to explain what I am trying to do

Class Baseclass(object):

 def __init__(self):
     pass

 def method_1(self):
    pass    

 def method_2(self):
    pass

Class Child(Baseclass):

 def __init__(self):
     pass

Here in the child class, If I need only method_1, how can I block the method_2 call

Aucun commentaire:

Enregistrer un commentaire