When, where and why we are using overloading and overriding???

Questions by spidervijay

Showing Answers 1 - 4 of 4 Answers

prosenjit roy chowdhury

  • Jun 15th, 2006
 

we use

  Was this answer useful?  Yes

Meena

  • Jul 8th, 2006
 

Overload

If One class can have more than one methods with the same name, it is called as Overloding.

Overridding

In inheritance, we can use the method which has the same name in Base and derived class , is called overriding.

  Was this answer useful?  Yes

fine questions

  • Jul 11th, 2006
 

Overloading is resolved at compile time and overriding is resolved at run time.

  Was this answer useful?  Yes

Vivek

  • Jul 31st, 2006
 

overloading  :- Same method name,Different signature and return type doesn't matter.
Overloading is generally used in same class.methods which perform the same task but in different wasy are given the same namFor eg Draw(float radius) method can be used to draw a circle,Draw(float side) can be used to draw square or  Draw(float base,float height)can be used to draw triangle.
Name of the methods is same as they all draw a figure.

Overriding :- Same method name,same signature and same return type also.
It is used in inheritance.When a subclass method wants to hide a superclass method it can use overriding.That means it can implement a method in the way it wants.In such case the superclass method is hidden.to call the superclass method ,'super' keyword has to used with the method name.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Answer Question

Click here to Login / Register your free account


 
Send   Reset

 

Related Answered Questions

 

Related Open Questions