Jan-19-2022, 05:39 AM
I have this little program
class Generic_Player:
def __init__(self):
self.hit = True
def Bust(self):
print(self.name + " busts.")
class Player(Generic_Player):
def __init__(self, name):
self.name = name
def Win(self):
print(self.name + " wins!")
def Lose(self):
print(self.name + " loses.")
player1 = Player("player1")
player1.Bust()
print(player1.hit) which gives me this errorError:Traceback (most recent call last):
File "/usr/lib/python3.8/idlelib/run.py", line 559, in runcode
exec(code, self.locals)
File "/home/fook/Documents/pygame/opencv/test.py", line 43, in <module>
print(player1.hit)
AttributeError: 'Player' object has no attribute 'hit'Since player1 is inherited from Generic_Player, True should be printed, no?
