Data Abstraction - Use of Super() in Python || Data Abstraction || Python

In this we are going to see a program on Data Abstraction - Use of Super() in Python Programming Language.


class Animal:
    def sound(self):
        print("Animal Sounds")
        pass

class Cat(Animal):
    def sound(self):
        print("Cat meows")

class Dog(Animal):
    def sound(self):
        print("Dog barks")

class Snake(Animal):
    def sound(self):
        super().sound()
        print("Snake hisses")


s = Snake()
s.sound()

# Coded by Saahil

#ENJOY CODING

Post a Comment

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

Previous Post Next Post