Commit ee7059d8 by BellCodeEditor

auto save

parent 1d5c5a40
Showing with 15 additions and 3 deletions
......@@ -9,8 +9,21 @@ class Cat:
def run(self):
print("小猫飞快的跑起来")
def skill(animal):
def skill(self,animal):
print('小猫抓住了',animal)
role = Cat()
role.skill("老鼠")
\ No newline at end of file
role.skill("老鼠")
类与对象(三)上完之后,交一个作业
1、类与对象的区别与联系。(要求配合例子说明)
2、如何一个定义一个类?
3、构造函数的什么?与什么作用?
4、类里的self指的是什么?
5、如何定义类方法?
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