# 重载不是多态的体现形式

Java 专栏收录该内容
29 篇文章 0 订阅

Polymorphism means “different forms.”In object-oriented programming, you have the same face(the common interface in the base class) and different forms useing the face: the different versions of the dynamically bound methods.

You've seen in this chapter that it's impossible to understand , or even create, an example of polymorphism without using data abstraction and inheritance. Polymorphism is a feature that cannot be viewed in isolation(like a switch statement can ,for example), but instead works only in concert, as part of a "big picture" of class relationships,People are often  confused by other, non-object-oriented features of Java, like method overloding, which are sometimes presented as object-oriented. Don't be fool:if it isn't late binding, it isn't polymorphism.

To use polymorphism-and thus object-oriented techniques-effectively in your programs you must expand your view of programming to include not just members and messages of an individual class, but also the commonality among classes and their relationships with each other. Although this requires significant effort, it's a worthy struggle, because the results are faster program development, better code organization, extensible programs, and easier code maintenance.


ps:

• 2
点赞
• 0
评论
• 2
收藏
• 一键三连
• 扫一扫，分享海报

10-05 6567
10-14 91

02-21 75
11-14 44
06-14 483
09-26 664
06-22 1047
06-23 80
09-08 245
02-06 3655
02-19 110万+
03-17 326
07-24 1万+
02-24 612