C++ Virtual Functions Question:

Can you please explain the difference between Overloading and Overriding?

Tweet Share WhatsApp

Answer:

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 same.
Overridden functions are in different scopes; whereas overloaded functions are in 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 same name functions which behave differently depending upon parameters passed to them.

Download C++ Virtual Functions PDF Read All 30 C++ Virtual Functions Questions
Previous QuestionNext Question
What is Virtual Table?Do you know the problem with overriding functions?