Was curious about the correct definition of the overridden method and the overriding method.
In my understanding the overriding method is the method in the subclass that overrides the method with same signature and return type in the base class.
I have however seen sources refer to the overridden method as being the method in the subclass that overrides the method in the base class.
So which is the overridden method and which is the overriding method?
Sorry if this is a bit of a silly question
A direct example from the Java Documentation :
The reason I used this example is, look at the scenario from your real-world situation. A
Animalmight have certain general features. But aCatwill have some features that are different from a genericAnimal, but certain features that are an improvement over the genericAnimalfeatures. So, theCatseems to override (will contain the overriding methods) theAnimalfeatures.Another simple example if you are interested in cars. Say, there is a
Car. It’ll have anaccelerationmethod. But aFerrariwill obviously have a betteraccelerationthan aCar. But, aFerrariis aCar. So,Ferrarioverrides a method inCar. SO, overriding method is in subclass and the overriden method is in the base class.So, do you get the point now? Overriding methods are present in the subclasses. But the methods that are overriden are present in the base class.