What is the difference between overloading and overridding?

Showing Answers 1 - 8 of 8 Answers

Anonymous

  • Jul 7th, 2005
 

overloading refers to -same name but different definitions and parmeters. 
Overriding refers to --'replacement' of methods.

Girish

  • Jul 23rd, 2005
 

In overloading you are extending the definition . 
ie if you over load a operator " + " whith a object then  
them + can be used to perform the basic additoin and defintion given at the time of operator overload . 
 
The overriding which used in Inheretence . ie if you want to change the definition .

  Was this answer useful?  Yes

Amit Banerjee

  • Sep 1st, 2005
 

Function Overloading is the implementation of static polymorphism where same function name having different defenitions for different uses. 
 
Function overriding is applicable for dynamic polymorphism where where the function name and the definition are same but the function call is decided at the run time according to the type of object reference.

  Was this answer useful?  Yes

ravi verma

  • Oct 5th, 2005
 

overloading

  Was this answer useful?  Yes

prince

  • Mar 2nd, 2006
 

overloading:

fuctions with same name but they differ by some parameters like no. of arg.,

type of arg.

overriding:

any local function can override global functin

  Was this answer useful?  Yes

me

  • Jan 15th, 2007
 

overloading is mainly for operators and overriding is for functions

  Was this answer useful?  Yes

Overloading is related to the use of a function or an operator. For example you can use a function for adding some integers as well as floats so this function is overloaded as it works for two different kind of inputs.
Where as overiding is in the case of classes in the object oriented programming or modeling. In this perspective you make a new class interacting with an existing one by implementing some new or restricted feature. For example you click to draw a shape from the menu but in the view class and further in every class (line, rectangle, triangle and circle etc) there exists a specific draw function.

  Was this answer useful?  Yes

Additionally:

Overloading is done in same scope (i.e. having two functions with same name (but different signature in same class scope or same file scope).
While
Overriding is specifically related to inheriting & inherited classes, i.e. inheriting (derived) class MAY override a function, which was already defined in inherited (base) class.

Overloading functions: will have different signature (i.e. argument list is different by No of Args OR Type of Args OR Order o Args)
While
Overriding Functions: will have same signature.

Overloading functions are resolved during compile time
while
Overriding functions are resolved during runtime.

  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.

 

Related Answered Questions

 

Related Open Questions