I wasn't sure how to name the title, so if anyone knows the specific name, please correct me. Here is my situation:
class Abs(object):
def run(self, var):
raise NotImplementedError
class Sub1(Abs):
def run(self, var):
var = get_var()
# Sub1 RUN
class Sub2(Abs):
def run(self, var):
var = get_var()
#Sub2 RUN
So as you can see I have to classes that inherit from the "interface" class and both have different run function. Even though some of the run functions are different between the two, there is some similar code. (as you can see in the example) Is there any way to write the common part in the "interface" class in order to not repeat it twice?