This video will tell you about method overriding in Python with example in detail.
Below is the python code:
class Animal:
def getName(self):
print("display name")
def speak(self):
print("dont know")
class Dog(Animal):
def speak(self):
print("Bark")
class Cat(Animal):
def speak(self):
print("Meow")
class Lion(Animal):
def speak(self):
print("Roar")
dog=Dog()
dog.speak()
cat=Cat()
cat.speak()
lion=Lion()
lion.speak()
Music: https://www.bensound.com