1

I've looked and I've looked, and can't find the academic answer I'm looking for.

If a method is polymorphic:

public class Widget
{
    public void doSomething()
    {
        // ...
    }

    public void doSomething(int fizz)
    {
        // ...
    }
}

... then doSomething can be said to be a polymorphic method of class Widget. I am looking for the academic/mathematical term to use when referring to the different varieties of a polymorphic method. For instance, in chemistry you have the concept of isotopes which are variants of atoms that simply have different numbers of neutrons. I want to be able to say that doSomething(int) is an x of doSomething(), much like Tritium is an isotope of Deuterium.

What's the correct terminology for two methods that are polymorphs of one another....just polymorphs? Polymorphic conjugates??!?

I know that somewhere, somebody knows the answer to this.

IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
  • 2
    The term "polymorphic method" has special meaning in many languages, and [may not refer to overloading](http://stackoverflow.com/questions/7236128/polymorphism-terminology/7236159#7236159). Use with caution. – bzlm Aug 29 '11 at 21:27
  • But beware: Java does not support multi-polymorphism/multi-methods, i.e. overloaded methods aren't dispatched dynamically, but the static type decides which method is chosen. If you want multi-polymorphism in Java, you can use the java multimethod framework (http://igm.univ-mlv.fr/~forax/works/jmmf/), but it uses reflection heavily. – DaveFar Sep 06 '11 at 17:15

1 Answers1

4

Overloaded method. Look at this wiki article.

Updated: how do I refer to doSomething(int) from the context of doSomething()
In languages like C++/C#/Java it is common pattern:

public class Widget
{
    public void doSomething()
    {
        // ...
        int default = 42;
        this.doSomething(default);
    }

    public void doSomething(int fizz)
    {
        // ...
    }
}
om-nom-nom
  • 62,329
  • 13
  • 183
  • 228
  • Yes, Widget in this case has an overloaded method. But my question is how do I refer to doSomething(int) from the context of doSomething()? I can't say that doSomething() has an overloaded method of doSomething(int), the same way I can say Tritium is an isotope of Deuterium. – IAmYourFaja Aug 29 '11 at 21:30
  • 1
    @Mara "doSomething(int) is an overloaded method of doSomething()" – rlb.usa Aug 29 '11 at 21:36
  • @Mara Updated answer. I hope I've correctly understand what you want. – om-nom-nom Aug 29 '11 at 21:36
  • Yep! For some reason I didn't know that it was alright to call one method an overload of another method; I thought it was only correct to say that some class has 1+ overloaded methods. Thanks! – IAmYourFaja Aug 29 '11 at 21:42
  • Oh, that's definitely not what you meant :) But @rlb.usa is completely right. – om-nom-nom Aug 29 '11 at 21:43