I have the following problem:
class A: animal = 'gerbil' def __init__(self): self.result = self.calculate_animal() def calculate_animal(self): print(self.animal) return self.animal class B(A): animal = 'zebra' def __init__(self): super(B, self).__init__()
Now I want a specific set of subclasses from A to implement a new function that computes something different with an animal, for example:
class CapitalizeAnimal: def calculate_animal(self): self.animal = self.animal.upper()
How do I get class C to implement the version of CapitalizeAnimal calculate_animal while keeping her animal as puma ? I'm confused about how the Mixin class can call the super () function.
source share