0
点赞
收藏
分享

微信扫一扫

Python - 类方法重写

浮游图灵 2023-03-22 阅读 74

# 类方法重写


class Father():

    def drink(self):

        print("父类drink")


    def eat(self):

        print("父类eat")


class Son(Father):

    def drink(self):

        print("子类drink")



son = Son()

son.drink()


举报

相关推荐

0 条评论