Thursday, November 3, 2011

Difference between method overriding and overloading

there is big difference between both:
see following example

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

Class B:A
{
public overrid void hi(int a)
{

}
}

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

Example for Over loading

Class A
{
class a()

{

}
class a(int a)
{
}
}

No comments:

Post a Comment