Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson15_test2
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
30239c89
authored
Aug 01, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
ce8530eb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
diy2-test.py
diy2-test.py
View file @
30239c89
class
Dog
:
# 狗类
def
__init__
(
self
):
def
__init__
(
self
,
name
):
self
.
footNum
=
4
# 腿
self
.
eyeNum
=
2
# 眼睛
self
.
head
=
1
# 头
self
.
earsNum
=
2
#
耳朵
self
.
earsNum
=
2
#
self
.
skin
=
"white"
self
.
name
=
name
def
run
(
self
):
print
(
"狗狗飞快的跑起来"
)
print
(
self
.
name
+
"狗狗飞快的跑起来"
)
class
Husky
(
Dog
):
# 哈士奇类
def
__init__
(
self
):
??
def
__init__
(
self
,
name
):
super
()
.
__init__
(
name
)
self
.
skin
=
'black and red'
coco
=
Husky
()
print
(
coco
.
skin
)
\ No newline at end of file
coco
=
Husky
(
'coco'
)
coco
.
run
()
print
(
coco
.
name
+
'是一只哈士奇,它有'
+
str
(
coco
.
footNum
)
+
'条腿'
,
'它有'
+
(
coco
.
earsNum
)
+
'个耳朵'
)
print
(
coco
.
skin
)
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