摘要
本文揭示了在面向对象程序设计语言中,若允许子类重定义其继承的父类方法以改变这些方法的规约,并且采用类似于Smalltalk-80中的继承机制的语义,将导致封装与继承之间的一个新问题.为此,本文提出了一种新的继承机制─—型构兼容的继承,以代替传统的增量继承.型构兼容的继承是一种灵活的代码复用机制,并且能够充分支持封装.本文给出了型构兼容的继承的操作语义和指称语义,为其在面向对象程序设计语言中的实现奠定了基础.
In this paper, the encapsulation issue in object-oriented languages is raised that adopting the semantics of inheritance such as the 'method lockup' algorithm in Smalltalk-80 and allowing subclasses to redefine inherited methods tochange their specifications severely compromises encapsulation in an object-oriented language. To resolve this encapsulation issue, a new inheritance mechanism called signature-compatible inheritance is presented. Signature-compatible inheritance is aflexible mechanism for reusing code and provides sufficient support for encapsulation. For its implementation in object-oriented languages, its operational semantics and denotational semantics are given.
出处
《计算机学报》
EI
CSCD
北大核心
1996年第1期23-29,共7页
Chinese Journal of Computers
基金
国家863高技术基金
国家教委博士点基金
江苏省科技应用基础基金
关键词
面向对象
继承
语义
程序
语言
型构兼容
Object-oriented programming language, inheritance, encapsulation, semantics.