Using overloading and overriding, we can get the concept of polymorphism. Polymorphism means one entity, multiple forms. By using one name, we can perform multiple of actions in multiple place.
Difference between overloading and overriding are given bellow:
Overloading
- It is a compile time polymorphism
- At the compile time the compiler know which object is assigned for which class
- Method name will be same, parameters will be different and its return type may or may not same
- Example- operator overloading, function overloading
Overriding
- It is a run time polymorphism
- At the compile time the compiler didn’t know which object is assigned for which class. Compiler knows it at run time
- Method name will be same, parameters will be same and its return type will be same
- Example- virtual function
very short. need more info.
It’s great to find soomnee so on the ball