What is the Difference between Overriding and overloading?

Answers were Sorted based on User's Feedback



What is the Difference between Overriding and overloading? ..

Answer / vimal

overloading-------having same method name with different
signatures.
overriding--------methods name and signatures must be same.

Is This Answer Correct ?    324 Yes 44 No

What is the Difference between Overriding and overloading? ..

Answer / lakshmi prabha

OverLoading : All the method will share the same name but
it differes based on the parameter, type of parameter and
number of parameter

Overriding : The method in the derived class the has the
same name in the base class and it changes the behaviour or
functionality of the method in the base class.

Is This Answer Correct ?    250 Yes 24 No

What is the Difference between Overriding and overloading? ..

Answer / prachee

overloading has same method but different types of
parameters, number of parameters.

overloading does not take return type to differentiate
overloaded method.

ex:
int add(int a, int b)
int add(float a , float b)
are overloaded methods

overriding comes with inheritance concept.
here parent and child both contains the same method. and
when execution takes place; child's method is called.

Is This Answer Correct ?    124 Yes 14 No

What is the Difference between Overriding and overloading? ..

Answer / sonia

OVERLOADING is the process of declaring the methods having
the same name but diff signatures. Signature means diff
types & number of arguments.

OVERRIDING is the process of overwriting the methods of
base class in Derived Class.

Is This Answer Correct ?    108 Yes 8 No

What is the Difference between Overriding and overloading? ..

Answer / nazrul

overriding->
1) method should be public.
2)it need inheritance.
3)it need virtual keyword before it declartion.
4)it have same name with same parameter in diffrent class.
5)it require non-static method.
6)method should have same datatype.
Overloading->
1)method can be different access speicifier.
2)it doesn't need inheritacne.
3)all method should be in same class.
4)method can have diffrent datatypes

Is This Answer Correct ?    88 Yes 8 No

What is the Difference between Overriding and overloading? ..

Answer / deepika singh

OVERLOADING:- 1) overloaded methods have the same name but
different parameter list.
2)a subclass method can overload a superclass method

eg:-int add(int a, int b)
int add(float a , float b)
are overloaded methods



OVERRIDING:-
it just in inheritance and the overriding
method must hold the same name and the same signatures .
the change maybe just in behavior .


The Cat class in the following example is the subclass and
the Animal class is the superclass. The Cat class overrides
eat() method inherited from Animal class.

public class Animal {

public void eat() {
System.out.println("Eat for Animal");
}
}

public class Cat extends Animal {

public void eat() {
System.out.println("Eat for Cat");
}
}

Is This Answer Correct ?    62 Yes 10 No

What is the Difference between Overriding and overloading? ..

Answer / sudhakar singh rajput

1-OverLoading is Resolved at COMPILE TIME.But Overridding is
resolved at RunTime.

2-OverLoaded Methods Can Change Access specifiers.in
overridding the access level of overridden method(in derived
class) must not be more restrictive than that of overridden
method(of base class)

3-Overloaded methods can declare new exceptions.But
overridden method must not throw new exceptions than those
declared by overridden method.

Is This Answer Correct ?    51 Yes 10 No

What is the Difference between Overriding and overloading? ..

Answer / yugal

OVERLOADING is the process of declaring the methods having
the same name but diff signatures. Signature means diff
types & number of arguments.
OVERRIDING is the process of overwriting the methods of
base class in Derived Class.

Overriding is the example of run-time polymorphism and
Overloading is the example of compile-time polymorphism.
Overloading

1) Method can have different access specifier.
2) Method can have different return type
3) Method must have same name with different method
signatures.
4) It doesn't need inheritance as method should be in
same class.

Overriding->

1) Method must have same access specifier.
2) Method must have same return type.
3) Method must have same name with same method
signatures.
4) It needs inheritance and virtual keyword before it
declaration.
5) It requires non-static method.

Is This Answer Correct ?    27 Yes 5 No

What is the Difference between Overriding and overloading? ..

Answer / omar

overriding: it just in inheritance and the overriding
method must hold the same name and the same signatures .
the change maybe just in behavior .

overloading : maybe in inheritance or in other way but must
to do overloading must the method hold the same name and
must change signatures.
remark:we can not only change th return type.

Is This Answer Correct ?    35 Yes 16 No

What is the Difference between Overriding and overloading? ..

Answer / sanjay

1-OverLoading is Resolved at COMPILE TIME.But Overridding is
resolved at RunTime.

2-OverLoaded Methods Can Change Access specifiers.in
overridding the access level of overridden method(in derived
class) must not be more restrictive than that of overridden
method(of base class)

3-Overloaded methods can declare new exceptions.But
overridden method must not throw new exceptions than those
declared by overridden

Is This Answer Correct ?    28 Yes 9 No

Post New Answer

More VB.NET Interview Questions

Can you please explain the difference between authentication and authorization?

0 Answers  


What is tracing?

0 Answers  


Explain namespace?

0 Answers  


How to create Crystal Report in vb.net with coding

1 Answers   A3Logics, Ascent, TCS,


Explain the difference between vb.net and c#, related to oops concepts?

0 Answers  






When do you use virutal keyword?

0 Answers  


What is the exact defination of object?

0 Answers  


What are the advantages of vb.net and c#?

0 Answers  


Define cls?

0 Answers  


Explain nested classes?

0 Answers  


How would you implement inheritance using vb.net?

0 Answers  


What are the advantages of migrating to vb.net?

0 Answers  


Categories