multilevel inheritance in python
class electronic_gadget:
ename="television"
pass
class tablets(electronic_gadget):
tname = "ipad"
pass
class mobiles(tablets):
mname = "iphone"
pass
obj=mobiles()
print("tname is tablet class variable ",obj.tname)
print("ename is electronic class variable",obj.ename)
print("mname is mobile class variable ",obj.mname)
Comments
Post a Comment