I have 2 classes, one inherits from the other. I need instances of WOFPlayer
to take 1 required parameter - name
, 2 optional and instances of WOFComputerPlayer
to take 2 required parameters - name
and difficulty
and 2 optional as in the WOFPlayer
. How do I do that?
Here's what I have tried
class WOFPlayer:
def __init__(self, name, prizeMoney = 0, prizes = []):
self.name = name
self.prizeMoney = prizeMoney
self.prizes = prizes[:]
class WOFComputerPlayer(WOFPlayer):
def __init__(self, difficulty):
WOFPlayer.__init__(self, name, prizeMoney = 0, prizes = [])
self.difficulty = difficulty
Thanks in advance