Python method overriding

7 Views
Published
Python method overriding tutorial example explained

#python #method #override

class Animal:

def eat(self):
print("This animal is eating")

class Rabbit(Animal):

def eat(self):
print("This rabbit is eating a carrot")


rabbit = Rabbit()
rabbit.eat()

Bro Code merch store
Category
Bro Code
Tags
python method overriding, python method override, python
Be the first to comment