Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

example of multiple inheritance python

class Father:
   fname = ""
   def father(self):
      print(self.name)

class Mother:
   mname = ""
   def mother(self):
      print(self.name)

class Child(Father, Mother):
   def parents(self):
      super().__init__()
      print("Hello Everyone!!!")
      print("Father :", self.fname)
      print("Mother :", self.mname)

s1 = Child()
s1.fname = "Harry"
s1.mname = "Ginny"
s1.parent()
Source by www.i2tutorials.com #
 
PREVIOUS NEXT
Tagged: #multiple #inheritance #python
ADD COMMENT
Topic
Name
7+1 =