overloading
about overloading and overriding
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Apr 4, 2013, 11:37 PM
hi,
In overloading two or more method has same name but different signatures.At compile time, the compiler find out which one method going to call, based on the compile time types of the arguments and the target of the method call.
public void MyTest()
{
}
public void Mytest(int id)
{
}
public MyTest(int id, string name)
{
}
Overloaded methods improve code clarity.
An override method provides a new implementation of a member inherited from a base class.it allows you to invoke functions (that have the same signatures) that belong to different classes in the same hierarchy of inheritance using the base class reference.
public class test
{
public virtual void getName(int id)
{
}
}
public class test2 : test
{
public override void getName(int id)
{
}
}
In overriding, name and signatures both are same.
Please refer
http://www.dotnetfunda.com/interview/exam3921-differences-between-method-overloading-and-method-overriding.aspx
hope this will help you.
Satyapriya NayakPosted Apr 4, 2013, 10:15 AM