北航研究生课程程序语言设计原理教程第10章.pptVIP

  • 3
  • 0
  • 约 60页
  • 2016-12-29 发布于北京
  • 举报

北航研究生课程程序语言设计原理教程第10章.ppt

第10章 面向对象程序设计语言 10.1.1 Smalltalk系统 10.1.2 用户界面模型 系统工作空间(System WorkSpace) 工作空间(WorkSpace) 系统副本(System Transcript) 项目(Project) 两种图形编辑窗(Form和Bit) 系统浏览器(System Browser)窗 10.1.3 语言核心 (5) 消息表达式与语句 10.1.5 Smalltalk程序设计范型 程序设计在类的层次上进行,由类静态(于工作空间指明向类发出消息)或动态(方法运行时)生成实例对象。每个对象当接受某消息并执行其方法的消息表达式时都是在自向其它对象发消息。 一个简单的Smalltalk程序 10.1.6 Smalltalk程序设计系统 实例对象的存储 实例对象只存放数据,其存储格式如下图: 10.4 Ada 的面向对象机制 以类宽类型实现多态 扩充程序包机制实现继承的类体系 with OS.Exceptions; package OS.File_Manager is -–OS的子辈程序包 type File_Mode is (Read_Only, Write_Only, Read_Write); function Open(File_Name:String; Mode; File_Mode) return File_Descriptor; procedure Close (File:in File_Descriptor); … end OS.File_Manager; --公有,只用私有类型。也无泄露 with OS.Exceptions; procedure OS.Interpret(Command:String); --命令解释过程,等同子包 private package OS.Internals is -–私有子辈程序包,不用with … end OS.Internals; private package OS.Internals_Debug is -—OS的私有子辈程序包 … end OS.Internals_Debug; Ada的多继承 with Abstract_Sets; package Linked_Sets is type Linked_Set is new Abstruct_Sets with private; --再定义Linked_Set的各种操作 private type Cell; type Cell_Ptr is access Cell; type Cell is record E:Element; next:Cell_Ptr; end record function Copy(P:Cell_Ptr)return Cell_Ptr; type lnner is new Controlled with record The_Set:Cell_Ptr: end record: procedure Adjuse (Obj :in out lnner); type Linked_Set is new Abstract_Sets with -—继承Abstraet_sets record Component:lnner: --其扩展成分又继承了Controlled end record; end Linked_Sets; 10.5 Eiffel的对象 Eiffel有传统语言的赋值、变量、控制(三种)、函数/过程、调用/参数匹配、类属、异常等概念和机制,它在这些概念与机制之上定义类和对象。 Eiffel把类和类型同等看待,类是抽象数据类型的实现 类型分为两种:一为尽头(expended)类型,这就是其它语言中的基元类型,引用(referance)类型,

文档评论(0)

1亿VIP精品文档

相关文档