Overriding in OOP – General to Specific – Movingtrend
Overriding is very useful concept of the Object-Oriented
Programming. Overriding is used to follow the concept generality but to deliver
Overriding follow the concept of Super-Class but deliver
Specific concept of Sub-class.
Overriding is a concept like waterfall. Upside
generalization operates as specific functionality. The specific implementation
of the function is based on cocept that is defined at the general level.
What is overriding in OOP?
The methods or functionalities or properties that are
defined in Super-Class; with the same name are available at Sub-class. The mode
of general functionality is changed into specific functionality at sub-level.
The function that is override is called overridden method at Super-class level
and overriding method at sub-class level repectively.
Let’s consider there is an example of Animal SuperClass, as
we know that all animals can move and eat. The specific case of the Animal
SuperClass would be the cat, dog, tiger or giraffe etc. Let’s consider the
Animal Super-Class defined two methods named move(), and eat(). Each animal can
move and eat. move() is the overridden method of the Animal SuperClass and
move() method will be the overriding method for the Cat SubClass.
In OOP; the object is responsible for managing a set of references exactly the same way the overriding methods of SubClass in OOP referred the method of SuperClass. The overriding could change the functionality into specific implementation.