I am trying to find the reason for my issue here, on google, and on youtube with no success.
class Profession:
def __init__(self, name):
self.name = name
class Wizard(Profession):
def __init__(self, name, spell):
# Profession.__init__(self, name)
super(Wizard, self).__init__(name)
self.spell = spell
class Archer(Profession):
def __init__(self, name, attack):
# Profession.__init__(self,name)
super(Archer, self).__init__(name)
self.attack = attack
class Rogue(Wizard,Archer):
def __init__(self, name, spell, attack):
super(Rogue, self).__init__(spell, name)
super(Wizard, self).__init__(attack, name)
wizard = Wizard('Magic', 'Abrakadabra')
archer = Archer('Robin Hood', 'Arrow')
print(wizard.name, wizard.spell)
print(archer.name, archer.attack)
rogue = Rogue('Dodgy', 'Spell', 'Attack')
print(rogue.name, rogue.spell, rogue.attack)
It errors out once I try to initialise 'rogue' object.
TypeError: Archer.__init__() missing 1 required positional argument: 'attack'
When I use explicit init, everything works.