In this we are going to see a program on generation performances using multilevel inheritance in Python Programming Language.
class Father:
ball = 6
class Son(Father):
dance = 1
ball = 9
def dancing(self):
return "Son Is Dancing {} time(s) using {} balls".format(self.dance, self.ball)
class Grandson(Son):
dance = 6
guitar = 1
def dancing(self):
return "GrandSon Is Dancing {} time(s) using {} guitar".format(self.dance, self.guitar)
hfc = Father()
abhishek = Son()
amit = Grandson()
print("Grandfather is playing with {} balls.".format(hfc.ball))
print(abhishek.dancing())
print(amit.dancing())
# Coded By Dhiraj Shelke
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP