Hybrid Inheritance Example in Python

8 / 100 SEO Score
class Base:
def geta(self):
return 10
def getb(self):
return 20
class Derived1(Base):
def sum(self):
return(self.geta()+self.getb())
class Derived2(Base):
def sub(self):
return(self.getb()-self.geta())
class LastDerived(Derived1,Derived2):
def avg(self):
print(self.sum()+self.sub())
Id=LastDerived()
Id.avg()

Leave a Reply

Your email address will not be published. Required fields are marked *