In this we are going to see a basic program of animal class using hierarchical inheritance in Python Programming Language.
class Animal:
def eats(self):
print("Animals eat variety of foods")
class Cat(Animal):
def ceats(self):
print("Cat and Kitten eat Fish")
class Dog(Animal):
def deats(self):
print("Dog and Puppy eat Meat")
c = Cat()
d = Dog()
c.eats()
d.eats()
# Coded by Saahil
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP