Difference between Overloading and Overriding

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

  1. It is a compile time polymorphism
  2. At the compile time the compiler know which object is assigned for which class
  3. Method name will be same, parameters will be different and its return type may or may not same
  4. Example- operator overloading, function overloading

Overriding

  1. It is a run time polymorphism
  2. At the compile time the compiler didn’t know which object is assigned for which class. Compiler knows it at run time
  3. Method name will be same, parameters will be same and its return type will be same
  4. Example- virtual function

Comments

  1. By Kerman Smith

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *