Commit 5abb7a40 by BellCodeEditor

auto save

parent e897c684
Showing with 20 additions and 0 deletions
class hero:
class hero:
#创建初始化方法__init__()
def __init__(self,name): #形参 变量
self.level = 1
self.hp = 300
self.att = 20
self.name = name
# def update(self):
# self.level += 1
# self.hp += 50
# self.att += 5
#实例化对象
yase = hero("亚瑟")#实参 具体的数据
yase.update()
print(yase.hp)
houyi = hero("后羿")
print(houyi.hp)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment