Home > DeveloperSection > Interviews > How is method overriding different from method overloading?

Posted on    October-25-2010 12:00 AM

 C# C# 
Ratings:
 2 Answer(s)
  900  View(s)
Rate this:

Pushpendra Singh

Total Post:241

Points:1205
Posted on    October-30-2010 12:00 AM

When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same name within the class.

Pushpendra Singh

Total Post:241

Points:1205
Posted on    October-30-2010 12:00 AM

When overriding, you change the method behavior for a derived class.
e.g Clas x
{
Virtual void sum(int a)
{
}
}

Class B:x
{
public overrid void sum(int a)
{

}
}

Overloading simply involves having a method with the same name within the class.

Example for Over loading

Class A
{
class b()

{

}
class b(int a)
{
}
}


Don't want to miss updates? Please click the below button!

Follow MindStick