面向对象.py 265 B

12345678910111213141516
  1. # -*- coding: UTF-8 -*-
  2. class AP():
  3. def __init__(self, name, hp=668, atc= 78):
  4. self.name = name
  5. self.hp = hp
  6. self.atc = atc
  7. def attck(self):
  8. print(self.atc)
  9. zj = AP('甄姬')
  10. xq = AP("小乔", 990, 1)
  11. xq.attck()