Saturday, 8 May 2021

Multiple Inheritance: Ronaldo and his Prostitutes

#showing subclass can access the functions of the main classes


class Ronaldo():
   def gardening(self):
       print("i enjoy gardening")

class Ronaldos_prostitutes():
   def cooking(self):
       print("i enjoy cooking")
#subclass
class Their_Bastard_Child(
Ronaldo, Ronaldos_prostitutes):
    def singing(self):
        print("i enjoy singing")
#lets see how the child gets the functions of the parents.
c =
Their_Bastard_Child()
c.singing()
c.gardening()
c.cooking()

 

 

No comments:

Post a Comment