Why do we override a function

Hi i am new in kotlin. I am a new learner of kitlin (android studio). I would like to know why do we override a function.

I have been overriding some functions that return “Run” so they can return “Walk” but i don’t really know the importance I could just write “Walk”

Overriding a function (or any other parameter) means that it already exists in a superclass and you’re declaring that your inherited class does the same thing, but with a different behavior.

It’s pretty much what the documentation says:

If a member function or property is declared as open , subclasses may override it by providing a new implementation.

This is a basic principle of Object Oriented Programming. You might want to read more about OOP to understand it.

Yes, it’s fundamental OOP stuff (inheritance) and I think because of open close in S.O.L.I.D principle.
Watch this uncle bob’s video: https://www.youtube.com/watch?v=zHiWqnTWsn4&t=1641s