Let's say I want to create SomeClass
, which inherits from two classes:
class SomeClass(InheritedClass1, InheritedClass2):
Both the InheritedClass1
and InheritedClass2
have the method with the same name, named performLogic
.
If I declare super().peformLogic()
, I will get result only from the first argument/inherited class. I need the results of both, so my question is, is there a way to call the method from the InheritedClass1
and then from the InheritedClass2
by using super()
?
Thanks.
EDIT:
Class example which I need to 'solve' is constructed like this (simplified, and skipped non-essential methods for brevity):
class One:
...
def getOutput(self):
self.output = self.performLogic()
return self.output
class Two(One):
...
def getFirstValue(self):
return input()
def getSecondValue(self):
return input()
class Three(Two):
...
def performLogic(self):
(some logic performation based on inputs from class Two methods)
class Four(Two):
...
def performLogic(self):
(some *different* logic performation based on inputs from class Two methods)
What I need to do now is implement a class which will perform logic of both class Three
as well as class Four
but with only one pair of input values. So I declared:
class Five(Three,Four):
def performLogic(self):
*and here I got stuck*
*super().performLogic() will ask me for input values and returns the
*result of class Three's performLogic()*
*but what of class Four, I need the result of it's performLogic() with
*a single pair of input values, too?*