Commit 18d997f7 by BellCodeEditor

save project

parent f17820f5
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