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 do nonglobal variables default to a) auto b) register c) static
Can turbo c++ run c program?
Is map thread safe c++?
Are there interfaces in c++?
What is c++ runtime?
How would you obtain segment and offset addresses from a far address of a memory location?
What is math h in c++?
On throwing an exception by the animal constructor in p = new animalq, can memory leak occur?
What is class invariant in c++?
Explain deep copy and a shallow copy?
What does new return if there is insufficient memory to make your new object?
What is the default access level?
What kind of jobs can I get with c++?
Which function cannot be overloaded c++?
Is it possible for a member function to delete the pointer, named this?