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 basic if statement syntax?
Why do we use constructor?
What is flush programming?
Write a program which is required to process the time of a clock in hours and minutes, entered from the keyboard. With this program, there are two requirements for any data entered by a user: 1. The data must be of the correct type (in this case, two ints). 2. The data must be in the correct range: this means that, for the minutes, negative numbers and any number above 59 must be rejected; for the hours, negative numbers and any number above 23 must be rejected. Output error message for invalid data input. Output the time one and a half hour after the time input. i.e. Hour: 22 Min: 32 One and a half hour after 22:32 is 00:02
Is c++ the hardest language?
What do the keywords volatile and mean mutable?
What are exceptions c++?
What is a constructor and how is it called?
How can you differentiate between inheritance and implementation in c++?
Is c++ still in demand?
What are virtual constructors/destructors?
What is the difference between a type-specific template friend class and a general template friend class?
Write a single instruction that will store an EVEN random integer between 54 and 212 inclusive in the variable myran. (NOTE only generate EVEN random numbers)
What is a wchar_t in c++?
Write about the use of the virtual destructor?