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 are shallow and deep copy?
What is setfill c++?
What is c++ & why it is used?
Why is c++ considered difficult?
Explain what is class definition in c++ ?
What is the difference between the compiler and the preprocessor?
You run a shell on unix system. How would you tell which shell are you running?
What is iterator in c++?
What is public, protected, private in c++?
How do you clear a set in c++?
Explain one-definition rule (odr).
Is there any function that can skip certain number of characters present in the input stream?
Can a program run without main function?
What is the difference between a baller and a reference in C++?
Describe new operator?