Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson15_2_1
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
9dc659ac
authored
Aug 12, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
ce44dbd8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
4 deletions
dhvja.py
diy2.py
diy3.py
wejgv.py
dhvja.py
0 → 100644
View file @
9dc659ac
class
Dog
():
def
__init__
(
self
):
self
.
foot
=
4
#腿
self
.
color
=
"white"
class
Husky
(
Dog
):
def
run
(
self
):
print
(
"狗狗正在快速的跑"
)
class
wangcai
(
Husky
):
pass
wangcai
=
wangcai
()
wangcai
.
run
()
diy2.py
View file @
9dc659ac
...
@@ -22,11 +22,19 @@ class Hero: # 英雄类
...
@@ -22,11 +22,19 @@ class Hero: # 英雄类
exit
()
exit
()
class
Player
():
# 玩家英雄
class
Player
(
Hero
):
# 玩家英雄
def
__init__
(
self
,
name
):
def
__init__
(
self
,
name
,
hero_type
):
???
super
()
.
__init__
(
name
)
self
.
hp
=
200
self
.
attack
=
50
self
.
hero_type
=
hero_type
print
(
self
.
name
,
"创建成功,英雄的类型是"
,
self
.
hero_type
)
print
(
"当前的等级,攻击力,血量是"
,
self
.
level
,
self
.
attack
,
self
.
hp
)
player
=
Player
(
"后羿"
)
player
=
Player
(
"后羿"
,
"射手"
)
print
(
"玩家的血量值为:"
,
player
.
hp
)
print
(
"玩家的血量值为:"
,
player
.
hp
)
print
(
"玩家的攻击力为:"
,
player
.
attack
)
print
(
"玩家的攻击力为:"
,
player
.
attack
)
diy3.py
0 → 100644
View file @
9dc659ac
class
Cat
():
def
__init__
(
self
):
self
.
eye
=
2
self
.
foot
=
4
self
.
color
=
"black"
def
eat
(
self
):
print
(
"今天吃了xxx"
)
cjza
=
Cat
()
cjza
.
eat
()
wejgv.py
0 → 100644
View file @
9dc659ac
class
Animal
():
def
__init__
(
self
):
self
.
foot
=
4
# 腿
self
.
color
=
"white"
self
.
weight
=
"19kg"
class
Bird
(
Animal
):
def
__init__
(
self
):
super
()
.
__init__
()
self
.
foot
=
2
self
.
weight
=
"8kg"
niao
=
Bird
()
print
(
niao
.
foot
,
niao
.
weight
)
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