上传文件至「/」
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
class Geji: #父类歌姬
|
||||
def __init__(self, name, color):
|
||||
self.name = name
|
||||
self.color = color
|
||||
def show(self): #父方法
|
||||
print(f"{self.name} is {self.color}")
|
||||
class RedGeji(Geji): #红子类
|
||||
def show(self): # 重写方法
|
||||
print(f"{self.name} is {self.color},红必秒蓝")
|
||||
class BlueGeji(Geji): #蓝
|
||||
def show(self):
|
||||
print(f"{self.name} is {self.color},蓝必秒红")
|
||||
teto = RedGeji("teto", "red")
|
||||
miku = BlueGeji("miku", "blue")
|
||||
def go(geji):
|
||||
geji.show()
|
||||
go(teto)
|
||||
go(miku)
|
||||
Reference in New Issue
Block a user