Skip to main content

Write a program to implement method overriding.

· One min read
Kaustubh Kulkarni
file.py
class Fruits:
def show(self):
print("This is Fruits class")
class Apple(Fruits):
def show(self):
print("Apple")
a=Apple()
a.show()
f=Fruits()
f.show()

output:

Output
Apple
This is Fruits class