Commit c94ac92e by BellCodeEditor

save project

parent 1cf9f5c8
Showing with 29 additions and 8 deletions
class Cat:
def __init__(self):
self.footNum = 4 # 腿
self.eyeNum = 2 # 眼睛
self.head = 1 # 头
self.earsNum = 2 # 耳朵
self.skin = "black"
def run(self):
print("小猫飞快的跑起来")
def skill(self, prey):
print("小猫抓住了"+prey)
role = Cat()
role.run()
role.skill("老鼠")
\ No newline at end of file
class Dog: # 狗类
def __init__(self):
def __init__(self,name):
self.name=name
self.footNum = 4 # 腿
self.eyeNum = 2 # 眼睛
self.head = 1 # 头
......@@ -7,12 +8,15 @@ class Dog: # 狗类
self.skin = "white"
def run(self):
print("狗狗飞快的跑起来")
print(self.name+"飞快地跑起来")
class Husky(Dog): # 哈士奇类
def __init__(self):
??
coco = Husky()
print(coco.skin)
\ No newline at end of file
def __init__(self,name):
super().__init__(name)
self.skin='black'
print('你有一只'+self.skin+'的'+self.name)
print(self.name+"飞快地躲起来")
xixi=Dog(input('你养了一只'))
xixi.run()
coco = Husky(input('他养的是'))
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