Commit b40bee94 by BellCodeEditor

save project

parent 1880aea5
Showing with 10 additions and 8 deletions
class Cat:
def __init__(self):
class Cat: #定义一个类Cat
def __init__(self): #定义类的属性
self.footNum = 4 # 腿
self.eyeNum = 2 # 眼睛
self.head = 1 # 头
self.earsNum = 2 # 耳朵
self.skin = "black"
def run(self):
def run(self): #定义类的方法
print("小猫飞快的跑起来")
def skill():
??
def skill(self,name): #定义类的方法 skill
print("小猫杀死了"+name)
role = Cat()
role.skill("老鼠")
\ No newline at end of file
role = Cat() #实例化Cat类的对象 role
role.run
role.skill("大老鼠")
\ 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