Python - Polymorphism and Dynamic Behavior
What will be the output of this code?
class Bird:
def sound(self):
return "Chirp"
class Dog:
def sound(self):
return "Bark"
def animal_sound(animal):
return animal.sound()
print(animal_sound(Bird()))
print(animal_sound(Dog()))