Overview of Polymorphism -多态的分类
Posted zzfx
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Overview of Polymorphism -多态的分类相关的知识,希望对你有一定的参考价值。
多态有类型系统衍生。
有限类型、无限类型、确定类型。
Classifications
Christopher Strachey (1967) introduced the concept of polymorphism informally into procedural programming languages by distinguishing functions
- that work differently on different argument types
- that work uniformly on a range of argument types
He defined the former as ad-hoc polymorphism and the latter as parametric polymorphism:
"Ad-Hoc polymorphism is obtained when a function works, or appears to work, on several different types (which may not exhibit a common structure) and may behave in unrelated ways for each type. Parametric polymorphism is obtained when a function works uniformly on a range of types; these types normally exhibit some common structure." (Strachey, 1967)
Cardelli and Wegner (1985) expanded Strachey‘s distinction to accommodate object-oriented languages. They distinguished functions
- that work on a finite set of different and potentially unrelated types
- coercion
- overloading
- that work on a potentially infinite number of types across some common structure
- inclusion
- parametric
Inclusion polymorphism is specific to object-oriented languages.
https://scs.senecac.on.ca/~oop244/pages/content/adhoc.html
以上是关于Overview of Polymorphism -多态的分类的主要内容,如果未能解决你的问题,请参考以下文章
Overview of Flashback Technology
An Overview of Cisco IOS Versions and Naming