Click here to Skip to main content
15,897,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
class User:
    def __init__(self, attack, movement):
        print("logged in\n\n\n\n")
        self.attack = attack
        self.movement = movement

    def attack(self):
        print(f" WTF##attack{self.attack()}\n\n\n")


class Wizard(User):
    def __init__(self, name, age, attack, movement: 100):
        self.name = name
        self.age = age
        super().__init__(attack, movement)
        print(f"attack of wizard:{self.attack}\n\n")
        print(f"movement speed is :{self.movement}\n\n")


class Archer(User):
    def __init__(self, arrows, attack, movement):
        self.arrows = arrows

        super().__init__(attack, movement)
        print(f"attack of attack is:{self.attack}")
        print(f"movement of archer is:{self.movement}")

    def check_arrows(self):
        print(f"No. of arrows are {self.arrows}")
        return f"ARCHER:@F*** U WIZARDS@"


class Bruno(Wizard, Archer):
    def __init_(self, name, attack, movement, arrows):
        Archer.__init__(self, name, arrows, movement)
        Wizard.__init__(self, attack)


gray = Bruno("name", 10, 100, 100)

player1 = User(100, 2010)
wizard1 = Wizard("bon", 10, 100, 20)
n = 100
m = 1000
arch = Archer(10, 100, 20)
print(
    f'\n\n\nWIZZY BOY INFO:\n NAME:{wizard1.name}\nAGE: {wizard1.age}\nAttck: {wizard1.attack}\nSpeed: {wizard1.movement}\nWIZZARDS:@F*** YOU ARCHERS@')
print(f"\n\n\nArcher info \n Attack{arch.attack}\nMovement{arch.movement}" + arch.check_arrows())
print(arch.check_arrows())


What I have tried:

this is my first time trying multiple inheritance..the code was running fine before i added class bruno
Posted
Comments
Richard Deeming 27-Mar-20 10:20am    
Don't you need to pass the age parameter to Wizard.__init__?
CPallini 27-Mar-20 10:38am    
My virtual 5.
Xion1624 27-Mar-20 10:48am    
not absolutely necessary cause i'm just trying to learn multiple inheritance

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900