Python Class Sequential Inheritance

#Python #OOP

# An experiment on python super
class Base:
    def __init__(self):
        print("Start A")

        print("End A")


class IA(Base):
    def __init__(self):
        print("Start IA")
        super(IA, self).__init__()
        print("End IA")


class IB(IA):
    def __init__(self):
        print("Start IB")
        super(IB, self).__init__()
        print("End IB")


print("Experiment 1:")

ib = IB()

Published: by ;

LM (2020). 'Python Class Sequential Inheritance', Datumorphism, 12 April. Available at: https://datumorphism.leima.is/til/programming/python/python-class-inheritance-sequential/.

Current Ref:

  • til/programming/python/python-class-inheritance-sequential.md