Overriding a method and defining a new function may look similar, but they are used for completely different reasons.
You're basically saying:
“This method already exists in the parent class, but I want to change how it behaves in my new class.”
You keep the same method name, but you give it new behavior.
This is useful when you want different classes to have the same function name but behave differently.
For example:
Dog and a Cat both have a method called sound(), but they return different sounds.This is part of polymorphism, which is a core idea in OOP.
You're adding brand-new behavior that didn’t exist before.
You are basically saying:
“The parent class didn’t have this function, so I’m creating it for my class.”
This function has no connection to anything in the parent class.
Override a method → change or customize existing behavior from the parent
Define a new function → add new behavior that didn’t exist earlier
Even though the syntax looks similar, the purpose is totally different.
That’s why overriding exists — it lets different classes share the same method name but behave differently, which makes code cleaner and easier to manage.