Basic Data Abstraction in Python - 1 || Data Abstraction || Python

In this we are going to see a program on Basic Data Abstraction in Python - Type 1 in Python Programming Language.


class Animal:
    def sound(self):
        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):
        print("Snake hisses")


c = Cat()
c.sound()

d = Dog()
d.sound()

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