开发者

Polymorphism Terminology

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开发者_JAVA百科 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.


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)
    {
        // ...
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜