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
Can you help me with this one? Make a program that when a user inputed a Product Name, it will display its price, and when the user inputed the quantity of the inputed product, it will show its total price. The output must be like this: Product Name: Price: Quantity: Total Price: ..this is the list of products to be inputed: Cellphone - 1500 Washing Machine - 5200 Television - 6000 Refrigirator - 8000 Oven - 2000 Computer - 11000 thanks..:D
What is exception handling? Does c++ support exception handling?
Differentiate between a template class and class template in c++?
Why do we use structure in c++?
What are the advantages of c++?
How do you clear a map in c++?
Explain register storage specifier.
When you overload member functions, in what ways must they differ?
What can I safely assume about the initial values of variables which are not explicitly initialized?
Inline parameters : What does the compiler do with the parameters of inline function, that can be evaluated in runtime ?
What is c++ prototype?
Why ctype h is used in c++?
What are features of c++?
What is a list c++?
What does the following do: for(;;) ; a) Illegal b) Loops forever c) Ignored by compiler...not illegal