1.1 继承
玩家:
#player.py class Player: name = ‘’ __score = 0 def __init__(self, name): self.name = name self.__score = 0 def addScore(self): self.__score += 1 def resortScore(self): self.__score = 0 def __str__(self): return “name = ‘%s’, score = %s” % (self.name, self.__score) def __repr__(self): return ‘Player(%s)’ % str(self)
评论