0
点赞
收藏
分享

微信扫一扫

Python - 多类继承

巧乐兹_d41f 2023-03-22 阅读 82

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()

举报

相关推荐

0 条评论