Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson15_test1
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ee7059d8
authored
May 01, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
1d5c5a40
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
diy-test1.py
diy-test1.py
View file @
ee7059d8
...
...
@@ -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
、如何定义类方法?
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment