Download the BYJU'S Exam Prep App for free GATE/ESE preparation videos & tests - Download the BYJU'S Exam Prep App for free GATE/ESE preparation videos & tests -

Difference between Function Overloading and Function Overriding in C++

What is Function Overloading?

In the object-oriented programming world, function overloading is an important concept. In this feature, two or more functions can own the same name, but the parameters will be different. When a function name is overloaded with multiple assignments, then it is known as function overloading.

What is Function Overriding?

Function overriding provides an authority to redefine a method with the same name and signature as the inheriting class.

Difference between Function Overloading and Function Overriding in C++

S.No. Function Overloading Function Overriding
1. In function overloading, two or more functions can own the same name, but the parameters will be different. Function overriding permit us to redefine a method with the same name and signature
2. There is no requirement of the inheritance concept here. In function overriding, we need an inheritance concept.
3. In the case of function overloading, the signatures should be different. In the case of function overriding, the signatures should be the same.
4. We can use it as an example of compile time polymorphism. We can use it as an example of run time polymorphism.
5. It happens during compile time. It occurs during the run time.
6. A function has the ability to load multiple times. A function can be overridden only a single time.

Keep learning and stay tuned to get the latest updates on GATE Exam along with GATE Eligibility Criteria, GATE 2023, GATE Admit CardGATE Application Form, GATE SyllabusGATE Cut off, GATE Previous Year Question Paper, and more.

Also Explore,

Comments

Leave a Comment

Your Mobile number and Email id will not be published.

*

*