Discuss / Python / 研究研究结果。。。

研究研究结果。。。

Topic source

class Base(object):

    def __init__(self):

        print('Base __init__', self)

    def f(self):

        print('Basef')

class AA(Base):

    def __init__(self):

        super().__init__()

        print('AA __init__', self)

    def f(self):

        super().f()

        print('AAf')

class A(Base):

    def __init__(self):

        super().__init__()

        print('A __init__', self)

    def f(self):

        super().f()

        print('Af')

class B(Base):

    def __init__(self):

        super(B, self).__init__()

        print('B __init__', self)

    def f(self):

        super().f()

        print('Bf')

class C(B, AA, A):

    def __init__(self):

        super().__init__()

        print('C __init__', self)

    def f(self):

        super().f()

        print('Cf')

    def __str__(self):

        return 'This is an instance of class C'

c = C()

c.f()


  • 1

Reply