Q:

What is the difference between function overloading and Overriding in c++?

0

What is the difference between function overloading and Overriding?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answer:

There are some differences between function Overloading and Overriding.

  •  Overriding of functions occurs when one class is inherited from another class. Overloading can occur without inheritance.
  • Overloaded functions must differ in function signature ie either number of parameters or type of parameters should differ. In overriding, function signatures must be the same.
  • Overridden functions are in different scopes; whereas overloaded functions are in the same scope.
  • Overriding is needed when derived class function has to do some added or different job than the base class function. Overloading is used to have the same name functions that behave differently depending upon parameters passed to them.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Interview Questions and Answers(2022)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
How to create and use a reference variable in C++?... >>
<< Write a C++ program that describes function Overri...