第十二章 多态作Polymorphic和一般类型.pptVIP

  • 0
  • 0
  • 约8.02千字
  • 约 32页
  • 2019-04-15 发布于江苏
  • 举报

第十二章 多态作Polymorphic和一般类型.ppt

第十二章 多态操作Polymorphic和一般类型 多态操作需求的引入:在数据库概念上,有许多操作,例如查询操作,需要一个通用的独立于类型的格式,从而增加了软件设计的灵活性和可复用性 多态操作的分类: ---特定的多态:即是普通的重载操作 ---包含多态:允许一个特定类型的操作可以作用载子类型对象上 ---有界多态:多态的一般化描述,一个操作可以定 义在多种类型上 多态引入的需要实例 示例1.对类型“人”,有年龄age和增加年龄 IncAgeP的操作; 对类型“酒”,有酒龄age和酒龄的增加 操作IncAgeW Type Person is type wine is [name: string; [name:string; age:int; age:int; spouse: Person;]; bouquet:string;]; declare increaseAge:Person||int-Person Declare increaseAge:Wine||int -Wine (1)define incAgeP(n) is self.age:=self.age+n; (2

文档评论(0)

1亿VIP精品文档

相关文档