Your Ad Here

Wednesday, April 22, 2009

Overloading and Overridding

Type of Overloading
1) Function Overloading
2) Operator Overloading

Difference between overloading & overridding
Overloading is used when we want same name and different parmeters.
Overriding is used when we want to replace the method

In Overloading Name of the function is same but the arguments are different.
In Overriding a local function can override the global function.

overloading is mainly for operators and overriding is for functions

Example(Overloading)
public int add(int a, int b, int c)
{
return a + b + c;
}

public int add(int a, int b)
{
return a + b;
}

No comments:

Post a Comment