When working with multiple inheritance, I'm trying to understand why it works if you refer to the parents' class names in the child class, but it does not work if you use super(). Any help is appreciated.
#DOES NOT WORK WITH super()
#Parent 1 class
class Husband:
def __init__(self,strength):
self.strength = strength
#Parent 2 class
class Wife:
def __init__(self,looks):
self.looks = looks
#Child class
class Son(Husband,Wife):
def __init__(self,strength,looks):
super().__init__(self,strength)
super().__init__(self,looks)
son = Son('Goliath','GQ')
print(son.strength,son.looks)
#WORKS WHEN CALLING PARENT CLASS NAMES
#Parent 1 class
class Husband:
def __init__(self,strength):
self.strength = strength
#Parent 2 class
class Wife:
def __init__(self,looks):
self.looks = looks
#Child class
class Son(Husband,Wife):
def __init__(self,strength,looks):
Husband.__init__(self,strength)
Wife.__init__(self,looks)
son = Son('Goliath','GQ')
print(son.strength,son.looks)