Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Method Overloading considered polymorphism? [closed]

Is Method Overloading considered part of polymorphism?

like image 764
iTayb Avatar asked Mar 08 '10 09:03

iTayb


People also ask

Is method overloading a part of polymorphism?

Method Overloading is a Compile time polymorphism.

Is overloading same as polymorphism?

-Overloading is when you take an existing method and essentially define it again, but using different parameters which Java sees as a completely different method. -Polymorphism is when you extend the base functionality of a superclass.

Is method overriding same as polymorphism?

Overriding is when you call a method on an object and the method in the subclass with the same signature as the one in the superclass is called. Polymorphism is where you are not sure of the objects type at runtime and the most specific method is called.

Why is method overloading polymorphism?

Overloading is a form of polymorphism (parametric polymorphism) in the case that a method with the same name can behave differently given different parameter types. Overloading is when you have the same function name that takes different parameters.


1 Answers

There are different types of polymorphism:

  • overloading polymorphism (also called Ad-hoc polymorphism)
  • overriding polymorphism

So yes it is part of polymorphism.

like image 89
Darin Dimitrov Avatar answered Oct 05 '22 17:10

Darin Dimitrov