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


Please Help Members By Posting Answers For Below Questions

What is the need of a destructor?

635


Why is c++ difficult?

599


What can c++ be used for?

578


Explain the differences between private, public and protected and give examples.

564


What is malloc in c++?

554






How are virtual functions implemented in c++?

596


Using a smart pointer can we iterate through a container?

554


Should the member functions which are made public in the base class be hidden?

556


Which format specifier is used for printing a pointer value?

570


Explain all the C++ concepts using examples.

684


Which software is used for c++ programming?

610


What jobs can you get with a c++ certification?

581


Do class declarations end with a semicolon?

596


What is the purpose of templates in c++?

563


What are c++ templates used for?

613