c=Animal(A,B)
#创建一个c对象,继承A,B,python调用方法的顺序先在c内找,再去A,最后去B
class Tool:
#使用赋值语句定义 类属性,记录该类创建几个对象
count=0
def init(self,name):
self.name=name
Tool.count += 1 #这里是类属性,不能用self
class Game:
#定义一个类属性,用赋值语句
top_score = 0
#定义一个实例属性
def __init__(self,player_name):
self.player_name=player_name
#静态方法
@staticmethod
def show_help():
print("")
#类方法
@classmethod
def show_top_score(cls):
print("...%d" %cls.top_score)
def start_game(self):
print("...%s" %self.player_name)
Game.show_help()
Game.show_top_score()
game=Game(“xiao”)
game.start_game()