面向对象(五)super

super方法只是为了执行继承父级的init方法,若要详细,请参考别人的博客

class a(object):
    def __init__(self):
        print("aINIT")

    def a1(self):
        print("a")


class b(a):
    def __init__(self):
        super(b, self).__init__()
        print("bINIT")

    def b1(self):
        print("b")

b().a1()
>>>aINIT
>>>bINIT
>>>a

方法2:

原文地址:https://www.cnblogs.com/renfanzi/p/6042198.html