Example of Multiple Parent Class Inheritance in Python
In multiple inheritance one child class can inherit multiple parent classes.
# Father class created class Father: fathername = "" def show_father(self): print(self.fathername) # Mother class created class Mother: mothername = "" def show_mother(self): print(self.mothername) # Son class inherits Father and Mother classes class Son(Father, Mother): def show_parent(self): print("Father :", self.fathername) print("Mother :", self.mothername) s1 = Son() # Object of Son class s1.fathername = "Mark" s1.mothername = "Sonia" s1.show_parent()
2019-01-09T02:55:57+05:30
2019-01-09T02:55:57+05:30
Amit Arora
Amit Arora
Python Programming Tutorial
Python
Practical Solution