oop - Why does Wikipedia say "Polymorphism is not the same as method overloading or method overriding." -
I've looked around and I could not find any similar questions.
Here is the paragraph I:
The polymorphism method is not similar to overloading or law override. Polymorphism is related to the application of specific implementations only for one interface or more general base class. The method overloading refers to those who have the same name but have different signatures within the same class. The method is overwritten, where a subclass replaces one or more of the methods of the implementation of its parent methods, there is no overload of the method of polymorphism and the method is not overwritten.
Can anyone here explain this more clearly, especially "is not equal to imposing the method of polymorphism"? I am confused now. Thanks in advance.
Polyomorphism (very easily stated) is likely to use a derivative class where the base orbit Is expected:
class base {} class derived base {} base v = new received (); // oak
On the other hand, the method override, like a wiki, tells a method of changing method behavior in a derived class:
class shape {zero} () () () {/ * Nothing here, abstract *}} increases square square size {@Override zero draw () {/ * Here can draw square * /}}
Overloading is unrelated to legacy, it allows defining more functions with the same name which only differences in those arguments That is what they take.
Comments
Post a Comment