“Polymorphism applies to overriding, not to overloading”?

烂漫一生 提交于 2019-12-22 06:56:34

问题


I just read this line in book "Sun Certified Java Programmer" (page number-158) by Kathy Sierra and Bert Bates who worked as Master trainer at "Sun microsystems":

Polymorphism applies to overriding, not to overloading.

But some other books and articles say overloading is also a form of polymorphism.. i'm confused.. Please help..


回答1:


Don't believe the other books. Late binding (wiki) (with overriden/inherited methods) is polymorphism. Static binding is what applies to overloading.

The two bolded expressions are concepts you should familiarize yourself with as soon as possible. There are a number of available resources. Maybe start here.



来源:https://stackoverflow.com/questions/19406206/polymorphism-applies-to-overriding-not-to-overloading

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!