In this we are going to see a basic program on inheritance with animal example in Python Programming Language.
class Cat:
def ceats(self):
print("Cat and Kitten eat Fish")
class Dog:
def deats(self):
print("Dog and Puppy eat Meat")
class Kitten(Cat):
pass
class Puppy(Dog):
pass
class Food(Puppy,Kitten):
def eats(self):
print("Some Food")
f = Food()
f.eats()
f.ceats()
f.deats()
# Coded by Saahil
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP