language: en

Classes as Assertions

Neelam Soundarajan
Computer and Information Science The Ohio State University
Columbus, OH 43210
e-mail: neelam@cis.ohio-state.edu

Abstract: How do we formally specify the relation between a base class and a derived class? This question has two parts, a syntactic one, and a semantic one. The syntactic part is of course the easier of the two and the answer to that part is the standard contra/co- variance requirement on the arguments and result of any base class method redefined in the derived class. Our concern in the current paper is with the semantic part of the question, i.e., how do we specify the behavioral relation between the base class and the derived class? We show that the standard answer -which is the semantic counterpart of contra/co-variance- is too rigid, and does not allow some natural and common forms of inheritance. We then propose a more flexible way to specify the relation, and show how different types of behavioral relations between base classes and derived classes may be specified using our notation.