December 5, 2024
Object Oriented programming oop

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

Rashedul Alam

I am a software engineer/architect, technology enthusiast, technology coach, blogger, travel photographer. I like to share my knowledge and technical stuff with others.

View all posts by Rashedul Alam →

3 thoughts on “Difference between Overloading and Overriding

Leave a Reply

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