Difference between over loading and over ridding?

Answers were Sorted based on User's Feedback



Difference between over loading and over ridding? ..

Answer / azhar iqbal

overloading means when you define more than one function
with the same name but different with its signature.


over ridding means give the modified defination of the
inherited functions or methods.

Is This Answer Correct ?    8 Yes 1 No

Difference between over loading and over ridding? ..

Answer / rameshwar gaikwad

Difference

Method OverLoading
1. Same method name with different number of argument
2. Number of argument with different datatype
3. Each method may returns different type of value
4. All overloaded methods founds to be in one class.

Method OverRiding
1. Same method name with same number of argument
2. Number of argument with same datatype
3. Each method must returns same type of value
4. Each overrided method of base class founds in respective
derived class.

Is This Answer Correct ?    5 Yes 1 No

Difference between over loading and over ridding? ..

Answer / manish kushwaha

Hi All,
These two are very powerful concept in Java. I would like
to explain in veru simple way hope we will get it easily

1) Method OverLoading...
Always this concept comes with Same Name of methods

1) Mthod name should be same
2) Return type can be differ of methods
3) Most Important Condition is
a) Type of Parameter in methods
b) Number of paramenter in methods
c) Order of parameter in methods

Exp. 1 public void foo(String str a, int b){}
2 public int foo(int a, int b, int c){ }
3 public void foo(int a , double b){}
4 public void foo(double b , int a){}
5 public int foo(int a, int b, int c, int
d){ }

Like in above example one method can have any TYPE
of PARAMETER, 2,5 example of NUMBER of PARAMETER, 3,4
example of ORDER of parameter.
**Make sure that method overriding can be done in
same class and Sub/Super class both


2) Method Overriding.
Always method over riding happens only in Sub/Super
class concept
We have one method in super class and same method
in sub class with
1) Same mthod name
2) same method return type
3) same type of parameter
if above condition match then you can say this is
method over ring.....

Exp. Class A{
public int foo(int a, int b){}
}
Class B extends A{
public int foo(int d, int e){}
}
obove scenario is method over riding.

* Always Method overloading happens in Compile time
* Always method over riding happens in Run time.


Hope you got the concept.....
Thanks Manish

Is This Answer Correct ?    4 Yes 0 No

Difference between over loading and over ridding? ..

Answer / shashikanth c r

Overloading is nothing but compile time allocation where we
will come to know which method will be called. In this
method we can overload either a method or even operators
too.

Overridding is nothing but run time allocation. We being
programmers can let the program to deside which method
should be called during the execution. During comp time,
we will never come to know which object will call which
method. This can be achived by using VIRTUAL keyword.

Is This Answer Correct ?    4 Yes 1 No

Difference between over loading and over ridding? ..

Answer / srabani

overloading means one function name havimg different
arguements.
but overriding means the base as well as the derived class
havimg same function name

Is This Answer Correct ?    4 Yes 1 No

Difference between over loading and over ridding? ..

Answer / manav sharma

Overloading: Same function or operator responds differently
on different types on inputs. This is done by defining a
function (including operator fn() definition) with the same
name but different argument list.

Overriding: Redefining any base class function in a
derieved class to work differently than what is defined in
the base class. So, now the same function called with same
argument list will behave differently when called on the
objects of base and derieved class.

Important: Which instance of function to bind with the
object depends on the type of object on which the function
is called and is decided on compile time. This is also
called early binding or compile time polymorphism.

Is This Answer Correct ?    3 Yes 1 No

Difference between over loading and over ridding? ..

Answer / amit,mumbai

Overloading means when we write diffrent fun. With the Same name & with diffrent singnature then it is called overloading . Overiding means both base & derived class has same name.

Is This Answer Correct ?    4 Yes 2 No

Difference between over loading and over ridding? ..

Answer / nagababu

Overloading:-Writing Two or three methods with same name
but different parameters in same class,it is called
methodOverloading.

Overriding:-writing same methodname and parameters in
subclass and superclass with same return type,it is called
methodoverriding.

Is This Answer Correct ?    3 Yes 2 No

Difference between over loading and over ridding? ..

Answer / imlepakshi

over loading : diff functns hvng same name are invoked
during the program whnever required by the programmer.

over ridding : gvs modified defination 2 d functns

Is This Answer Correct ?    3 Yes 2 No

Difference between over loading and over ridding? ..

Answer / sri

overloading means when u define more than one function with
same name but different arguments and return type.it is
compiletime allocation
overriding means when we define more than one function with
same name,same arguments.it mainly used in inheritance
concept.it is runtime allocation

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More OOPS Interview Questions

what is the new version of c++

1 Answers   Ignou, Pramata, Satyam,


What is extreme programming?

2 Answers  


Which keyword is written to use a variable declared in one class in the other class?

5 Answers   TCS,


What is virtual Function.

1 Answers   Wipro,


What is meant by multiple inheritance?

0 Answers  






What do you mean by Encapsulation?

0 Answers   Ittiam Systems,


what is meant by files?

4 Answers   Infosys,


c++ program to swap the objects of two different classes

0 Answers  


How compiler selects(internally) required overridden function in inheritance?

2 Answers   CSC, Infinite Computer Solutions,


Input: enter the value:1234 output: 1 2 3 4 write a program to get above output.....

4 Answers   Bally Technologies, IBM, SoftSol,


Are polymorphisms mutations?

0 Answers  


Why it is called runtime polymorphism?

0 Answers  


Categories