多态有类型系统衍生。

有限类型、无限类型、确定类型。

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

Level 1 - universal vs, ad hoc polymorphism

    • functions that are universally polymorphic work uniformly for an infinite set of types
      all of which have some common structure

      • execute the same code for all admissible types
    • An ad hoc polymorphic function is just a syntactic abbreviation for small set of
      different monomorphic functions.

http://www.cs.kent.edu/~durand/CS43101Fall2004/DT-TypeSystems.html

Overview of Polymorphism -多态的分类的更多相关文章

  1. Objective-C中的封装、继承、多态、分类

    封装的好处: 过滤不合理的值 屏蔽内部的赋值过程 让外界不必关注内部的细节 继承的好处: 不改变原来模型的基础上,拓充方法 建立了类与类之间的联系 抽取了公共代码 坏处:耦合性强(当去掉一个父类,子类 ...

  2. C++员工管理系统(封装+多态+继承+分类化+函数调用+读写文件+指针+升序降序算法等一系列知识结合)

    1 C++职工管理系统 2 该项目实现 八个 功能 3 1-增加功能 2-显示功能 3-删除功能 4-修改功能 4 5-查找功能 6-排序功能 7-清空功能 8-退出功能 5 实现多个功能使用了多个C ...

  3. polymorphism多态

    [概念] 方法名相同,具体操作根据类不同. eg 有open()方法的ebook, kindle 都会被打开 eg 动物叫声不同 inheritance:只有superclass subclass都有 ...

  4. 7.6 GRASP原则六: 多态 Polymorphism

    GRASP原则六: 多态 Polymorphism  How to handle alternative behaviors based on type 如何处理依据类型不同而有 不同行为的一类需求 ...

  5. 深入Java核心 Java中多态的实现机制(1)

    在疯狂java中,多态是这样解释的: 多态:相同类型的变量,调用同一个方法时,呈现出多中不同的行为特征, 这就是多态. 加上下面的解释:(多态四小类:强制的,重载的,参数的和包含的) 同时, 还用人这 ...

  6. java中实现多态的机制是什么?

    多态性是面向对象程序设计代码重用的一个重要机制,我们曾不只一次的提到Java多态性.在Java运行时多态性:继承和接口的实现一文中,我们曾详细介绍了Java实现运行时多态性的动态方法调度:今天我们再次 ...

  7. 预习笔记 多态 --S2 4.3

    第三章 多态 polymorphism 多态 instance 例子override 重载 constructor 构造器ClassCastException 类型转换异常upcasting 上抛 d ...

  8. [.net 面向对象编程基础] (13) 面向对象三大特性——多态

    [.net 面向对象编程基础] (13) 面向对象三大特性——多态 前面两节,我们了解了面向对象的的封装和继承特性,面向对象还有一大特性就是多态.比起前面的封装和继承,多态这个概念不是那么好理解.我们 ...

  9. PHP面向对象编程之深入理解方法重载与方法覆盖(多态)

    这篇文章主要介绍了PHP面向对象编程之深入理解方法重载与方法覆盖(多态)的相关资料,需要的朋友可以参考下: 什么是多态? 多态(Polymorphism)按字面的意思就是"多种状态" ...

随机推荐

  1. Pycharm 的基本操作

    下载:https://www.jetbrains.com/pycharm/ 安装:随意安装在那个目录都可以 注册:可以采用 激活码 或者激活服务器,并对应在选项下面填入激活码或者激活服务器URL即可. ...

  2. 洛谷 P2959 [USACO09OCT]悠闲漫步The Leisurely Stroll

    P2959 [USACO09OCT]悠闲漫步The Leisurely Stroll 题目描述 Bessie looks out the barn door at the beautiful spri ...

  3. 【实时文件同步】rsync+inotify-tools的安装与配置

    http://blog.csdn.net/yakson/article/details/52044403

  4. nyoj891(区间上的贪心)

    题目意思: 给一些闭区间,求最少须要多少点,使得每一个区间至少一个点. http://acm.nyist.net/JudgeOnline/problem.php?pid=891 例子输入 4 1 5 ...

  5. jsp param动作标签

    param 标签以"名字-值"对的形式为其它标签提供附加消息.这个标签与jsp:include.jsp:forward.jsp:plugin标签一起使用. param 动作标签 & ...

  6. Oracle EBS 从Web界面进入责任时,提示不存在可用的有效责任

    Oracle EBS 从Web界面进入责任时,提示不存在可用的有效责任         每次在Web界面,点击某一责任的功能时,弹出Form.会提示错误:对不起,不存在可用的有效责任.         ...

  7. HDU 5532 / 2015ACM/ICPC亚洲区长春站 F.Almost Sorted Array

    Almost Sorted Array Problem Description We are all familiar with sorting algorithms: quick sort, mer ...

  8. 深入理解Android开发中的CoordinatorLayout Behavior

    在使用Android设计支持库(Android Design Support Library)时,很难避开CoordinatorLayout:设计库中有很多视图都需要CoordinatorLayout ...

  9. Codeforces--630C--Lucky Numbers(快速幂)

     C - Lucky Numbers Crawling in process... Crawling failed Time Limit:500MS     Memory Limit:65536K ...

  10. Enter the path to the kernel header files for the 3.18.0-kali1-686-pae kerne vmware tool

    安装VMWare Tools出现提示:Enter the path to the kernel header files for the 3.18.0-kali1-686-pae kerne? 201 ...