Multilevel inheritance
class dad:
basketball = 1
class son(dad):
basketball = 9
dance = 1
def isdance(self):
return f"yea i dance {self.dance} no if times"
class grandson(son):
dance = 6
# def isdance(self):
# return f"jackson can dance very awesomly {self.dance} no of times"
darry = dad()
larry = son()
harry = grandson()
print(harry.isdance())
print(harry.basketball)
Comments
Post a Comment