i know what is the maening for method overloading ....can any one explain me method overloading with real time .NET example plz

You've million dozens of examples for method overloading, and if you develop business applications you'll feel that. But let me give you an example; object initiation, you need some object(s) or none to initiate object, let's see SqlCommand class constructors, it let the developer initiate the class with whatever proper of objects he has\likes...

simply, you can create multiple methods of the same name, that accept different params, depending on what arguments you pass to your method, something specialized occurs.

example:

public static setTitle(string s)
{
     this.Text = s;
}

public static setTitle(string s, boolean alertUser)
{
     this.Text = s;
     if(alertUser == true)
     {
         messageBox.Show("form caption changed to "+s);
      }
}

happy coding

Edited 3 Years Ago by Reverend Jim: Fixed formatting

Here is a list of overloads for Convert.ToInt32() from the .NET framework.

public static int ToInt32(DateTime value);
public static int ToInt32(bool value);
public static int ToInt32(byte value);
public static int ToInt32(char value);
public static int ToInt32(decimal value);
public static int ToInt32(double value);
public static int ToInt32(float value);
public static int ToInt32(int value);
public static int ToInt32(long value);
public static int ToInt32(object value);
public static int ToInt32(object value, IFormatProvider provider);
public static int ToInt32(sbyte value);
public static int ToInt32(short value);
public static int ToInt32(string value);
public static int ToInt32(string value, IFormatProvider provider);
public static int ToInt32(string value, int fromBase);
public static int ToInt32(uint value);
public static int ToInt32(ulong value);
public static int ToInt32(ushort value);

i know what is the maening for method overloading ....can any one explain me method overloading with real time .NET example plz

In real world, we have a common verb serves different meaning.
For example,
to print

  • Print on printer
  • Print on screen
  • Print on disk/file

All three activities requires different actions but they uses common name (print).

In context of OOP, the term Overload is also know as polymorphism. Meaning of polymorphism is that an entity has multiple forms.

It is possible to define the same function twice while using different parameter for each definition.

Comments
In two threads you have picked apart the use of the english language while not contributing any beneficial suggestions. Try helping the users and laying off the criticism
This article has been dead for over six months. Start a new discussion instead.