multiple inheritance in python

technical talkiess
0

 Multilevel inheritance :- 


class Grandfather:

    farm = "1 acre"


class Son(Grandfather):

    bike = 1

    def bike_splender(self):

        return f"He has own splender bike";


class Grandson(Son):

    iphone = 1

   

    def bike_splender(self):

        return f"He does not have own splender bike";



mansign = Grandfather()

eknath = Son()

child = Grandson()


# print(child.bike_splender())



class Electric_device:

    no_of_device = "Lots of device avaible"

    def List_of_device(self):

        return f"The Device list is following {['iphone','light','switch','button']}"


class Pocket_gadget(Electric_device):

    Pocket_gadget = "Lots of pocket gadeget avaiavle Here "

    def gadget(self):

        return f"The gadget lis is{['phone','headphone','dummy phone','pocket','chager']}"

   

class Phone(Pocket_gadget):

    phone = "89 type of phone avaiable "


    def Phoone_list(self):

        return f"The phone list is {['iphone','oppos','nokia','samsung','motorolo']}"

   

electric = Electric_device()

pocket = Pocket_gadget()

phone = Phone()


print(phone.Phoone_list())

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)