In this we are going to see a program on animal example with multilevel inheritance in Python Programming Language.
class Animal:
def animal_sound(self):
print("An animal makes a sound")
class Cat(Animal):
def animal_type(self):
print("Animal is a cat")
class Kitten(Cat):
def cat_type(self):
print("The cat is a kitten")
k = Kitten()
k.animal_sound()
k.animal_type()
k.cat_type()
# Coded By Dhiraj Shelke
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP