Commit e3182544 by BellCodeEditor

save project

parent 22354288
Showing with 17 additions and 0 deletions
class Hero:
def __init__(self,dengji,age):
self.age = age
self.dengji = dengji
def upgraed(self):
self.dengji += 1
self.age += 1
houyi = Hero(age=12,dengji = 1)
yase = Hero(age = 5,dengji = 2)
houyi.upgraed()
houyi.upgraed()
yase.upgraed()
print(yase.dengji)
print(yase.age)
print(houyi.dengji)
print(houyi.age)
\ 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