Multiple inheritence

 


#! Multiple inheritence
#Child class ar bracket er moddhe jai class ar name age likhbo tar priority besy

#sobar moddhe super use kora lagbe sun mother father sobar/tahole e 
# son bap ma er instance veriable access korte parbe


#!Hierarchical Inheritence

class Father:
    
    def __init__(self):
        super().__init__()           # sob classs a super decchi
        print("Father class Constractor")

    def showf(self):
        print("Father class instance method")

    
class Mother():
    
    def __init__(self):
        super().__init__()        # sob classs a super decchi
        print("Mother class Constractor")

    def showm(self):
        print("Mother class instance method")

    

class Son(Father,Mother):
    
    def __init__(self):
        super().__init__()              # sob classs a super decchi
        print("Son class Constractor")

    def shows(self):
        print("Son class instance method")



munna=Son()


"""
OUTPUT:
Mother class Constractor
Father class Constractor
Son class Constractor
"""

Comments

Popular posts from this blog

D WEB LINK