Answer the question
In order to leave comments, you need to log in
Why is it not inherited?
Hello everyone, everything seems to be done correctly but does not want to work in any way, tell me what is the mistake
class Hero:
def __init__ (self, hero_name,hero_class):
self.hero_name = hero_name
self.hero_class = hero_class
def info(self):
print(self.hero_name, self.hero_class)
class WarriorHero(Hero):
def __init__(self,hero_name,hero_class):
super().__init__(hero_name,hero_class)
def equipmentHero(self):
self.type_clothing = "heavy"
self.weapons_hero = "sword"
self.shield_hero = "yes"
def healthHero(self):
self.health_hero = 100
def printed(self):
print("""
name: {0},
Class character: {1},
Health: {2},
Weapon: {3},
Shield: {4},
Clothing: {5}
""" .format(self.hero_name,
self.hero_class,
self.health_hero,
self.weapons_hero,
self.shield_hero,
self.type_clothing ))
b = Hero("kyklaed","warrior")
b.info()
a = WarriorHero("kyklaed","warrior")
a.printed()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question