Overloading and overriding
What is difference between overloading and overriding? Please explain with example.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Tom MohanRank #912 · 2.3K reputationPosted May 5, 2015, 10:41 PM EDT
Overloading
Overloading is when you have multiple methods in the same scope, with the same name but different signatures.
//Overloading public class test { public void getStuff(int id) {} public void getStuff(string name) {} }Overriding
Overriding is a principle that allows you to change the functionality of a method in a child class.
//Overriding public class test { public virtual getStuff(int id) { //Get stuff default location } } public class test2 : test { public override getStuff(int id) { //base.getStuff(id); //or - Get stuff new location } }Abrar Ahmad AnsariRank #3,390 · 425 reputationPosted May 5, 2015, 11:00 PM EDT
http://www.aspdotnet-suresh.com/2013/09/c-sharp-overloading-and-overriding-differences-with-example.html
http://www.dotnetfunda.com/articles/show/2971/polymorphism-method-overloading-and-overriding-in-csharp
Rajeesh MenothRank #118 · 18.4K reputationPosted May 6, 2015, 12:49 AM EDT
In Polymorphism we have 2 different types.
1) Overloading
2) Overriding
Explanation with Examples : http://stackoverflow.com/questions/673721/overloading-and-overriding