Go backward to Problems with Method Redefinition
Go up to Top
Go forward to Dynamically Scoped Objects
Problems with Subtyping
- New type attribute selftype
- class NAT2 = record
var NUM: newint;
fun EQ(X: selftype) =
(@X.NUM=@self.NUM) end
- class INT2 = inherits NAT2 with record
var ISNEG: newbool
fun EQ(Y: selftype) =
(@Y.ISNEG=@self.ISNEG) & ...end
- object N2: NAT2; object I2: INT2
- Typings
- N2.EQ: NAT2 boolexp
- I2.EQ: INT2 boolexp
- Problem:
- proc Q(Z:NAT2) = ...Z.EQ(N2) ...
- call Q(I2)
Subclasses are not subtypes!
Wolfgang.Schreiner@risc.uni-linz.ac.at
Id: qualification.tex,v 1.2 1996/05/02 11:53:49 schreine Exp schreine