摘要: 一:不同的类的对象如何实现交互呢? 因此必须掌握类中方法的传参和调用,例如要实现人狗大战中的交互,可以这么做,程序如下: class Person: role = 'person' # 静态属性 def __init__(self,name,sex,hp,ad): self.name = name 阅读全文
posted @ 2018-04-11 19:10 扬帆起航111 阅读(168) 评论(0) 推荐(0) 编辑
摘要: # class Person: # role = 'person' # 静态属性 # def f1(self): # 动态属性 方法(函数) 默认带一个参数self # print(1234567) # # print(Person.__dict__) # print(Person.__dict__ 阅读全文
posted @ 2018-04-11 08:36 扬帆起航111 阅读(202) 评论(0) 推荐(0) 编辑