Difference between Overloading and Overriding?
Answer Posted / vetrivel
Overloading vs. overriding
1.Overriding of functions occurs when one class is inherited from another class. Overloading can occur without inheritance.
2.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.
3.Overridden functions are in different scopes; whereas overloaded functions are in same scope.
4.Overriding is needed when derived class function has to do some added or different job than the base class function.
5.Overloading is used to have same name functions which behave differently depending upon parameters passed to them.
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is the need of a destructor?
Why is c++ difficult?
What can c++ be used for?
Explain the differences between private, public and protected and give examples.
What is malloc in c++?
How are virtual functions implemented in c++?
Using a smart pointer can we iterate through a container?
Should the member functions which are made public in the base class be hidden?
Which format specifier is used for printing a pointer value?
Explain all the C++ concepts using examples.
Which software is used for c++ programming?
What jobs can you get with a c++ certification?
Do class declarations end with a semicolon?
What is the purpose of templates in c++?
What are c++ templates used for?