Calling a Method in Python || Polymorphism || Python

In this we are going to see a program about Calling a Method in Python Programming Language.


class Animal:
    def speak(self):
        print("Animal")


class Dog(Animal):
    def speak(self):

        # Method 1
        Animal.speak(self)

        # Method 2
        super().speak()
        print("Dog")


d = Dog()
d.speak()

# Coded By Dhiraj Shelke

#ENJOY CODING

Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post