Is Method Overloading considered polymorphism?

30,765

Solution 1

"Polymorphism" is just a word and doesn't have a globally agreed-upon, precise definition. You will not be enlightened by either a "yes" or a "no" answer to your question because the difference will be in the chosen definition of "polymorphism" and not in the essence of method overloading as a feature of any particular language. You can see the evidence of that in most of the other answers here, each introducing its own definition and then evaluating the language feature against it.

Solution 2

There are different types of polymorphism:

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

So yes it is part of polymorphism.

Solution 3

Strictly speaking polymorphism, from wikipedia:

is the ability of one type, A, to appear as and be used like another type, B.

So, method overloading as such is not considered part of this definition polymorphism, as the overloads are defined as part of one type.

If you are talking about inclusion polymorphism (normally thought of as overriding), that is a different matter and then, yes it is considered to be part of polymorphism.

inclusion polymorphism is a concept in type theory wherein a name may denote instances of many different classes as long as they are related by some common super class.

Solution 4

There are 2 types of polymorphism.

  1. static
  2. dynamic.

Overloading is of type static polymorphism.. overriding comes under dynamic (or run-time) polymorphism..

ref. http://en.wikipedia.org/wiki/Polymorphism_(computer_science) which describes it more.

Solution 5

No, overloading is not. Maybe you refer to method overriding which is indeed part of polymorphism.

To further clarify, From the wikipedia:

Polymorphism is not the same as method overloading or method overriding.1 Polymorphism is only concerned with the application of specific implementations to an interface or a more generic base class.

So I'd say method overriding AND method overloading and convenient features of some language regarding polymorphism but notthe main concern of polymorphism (in object oriented programming) which only regards to the capability of an object to act as if it was another object in its hierarchy chain.

Share:
30,765
iTayb
Author by

iTayb

Just another guy surfing the web (:

Updated on July 09, 2022

Comments

  • iTayb
    iTayb almost 2 years

    Is Method Overloading considered part of polymorphism?