Question:
How is method overriding different from overloading?
Answer:
When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class. Source: CoolInterview.com
overriding is achieved by two keyword 1)virtual 2)override virtual in base class method while override in derived method (methods having same name and signature)
Overloading is methods having same name but different type and signature Source: CoolInterview.com
Answered by: Amirullah Khan | Date: 4/2/2010
| Contact Amirullah Khan
Overloading is the same function name with different arguments where as the overriding contains the parent child relationship.
Regards, Nicku Source: CoolInterview.com
Answered by: nicku | Date: 8/10/2010
| Contact nicku
Overloading contains the parent child relationship where as in overloading only one class is there. Ovearloading has the same function name with the different arguments
Regards, Nicku Source: CoolInterview.com
Answered by: nicku | Date: 8/16/2010
| Contact nicku
Overloading a method can be achieved by giving different parameters(arguments),may in data type r no of arguments,But where as overriding can be achieved by using same method signature.(No. Of Arguments and data type must be same). Source: CoolInterview.com
Answered by: Rakesh | Date: 9/3/2010
| Contact Rakesh
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|