class Camera():
def take_photo(self):
print("拍照")
class MP3():
def play_mp3(self):
print("播放MP3")
class Iphone(Camera,MP3):
def nfc(self):
print("NFC 功能")
# 多类继承
iphone = Iphone()
iphone.take_photo()
iphone.play_mp3()
iphone.nfc()
微信扫一扫
class Camera():
def take_photo(self):
print("拍照")
class MP3():
def play_mp3(self):
print("播放MP3")
class Iphone(Camera,MP3):
def nfc(self):
print("NFC 功能")
# 多类继承
iphone = Iphone()
iphone.take_photo()
iphone.play_mp3()
iphone.nfc()
相关推荐