I have a class ExampleSim
which inherits from base class Physics
:
class Physics(object):
arg1 = 'arg1'
def physics_method:
print 'physics_method'
class ExampleSim(Physics):
print 'example physics sim'
Imagine these classes containing lots of code.
Now I have made some modifications to Physics
by defining a new class PhysicsMod
and inheriting from Physics
:
class PhysicsMod(Physics):
arg1 = 'modified arg1'
but also to ExampleSim
for which I created a new class ExampleSimMod
and inherited from ExampleSim
:
class ExampleSimMod(ExampleSim):
print 'modified example sim'
My issue is that ExampleSimMod
inherits from ExampleSim
which inherits from Physics
where i would like to have it inherit from PhysicsMod
instead. Is there a way to do this? perhaps through super()
or by multiple inheritance?
class ExampleSimMod(ExampleSim, PhysicsMod):
print 'modified example sim'