Xref: utzoo comp.lang.eiffel:559 comp.object:696 Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!ukc!edcastle!lfcs!db From: db@lfcs.ed.ac.uk (Dave Berry) Newsgroups: comp.lang.eiffel,comp.object Subject: Real,Complex,Inheritance and Subtyping Message-ID: <1526@castle.ed.ac.uk> Date: 9 Jan 90 17:11:36 GMT Reply-To: db@lfcs.ed.ac.uk (Dave Berry) Organization: Laboratory for the Foundations of Computer Science, Edinburgh U Lines: 21 The class Complex can be defined using two attributes of class Real. Are there any languages in which it is then possible to make Real a subtype of Complex? Is this an example when subtyping should be separated from inheritance? Are there any better ways to do this? Should Real and Complex both be subtypes of class Numeric, with user-defined coercions? Are there any languages in which it is possible to ensure that Real + Real calls Real.+ and any combination of Reals and Complexes calls Complex.+ , without having to define all cases explicitly? Aside: the standard OO response is that the function called depends on the first argument of the function call/message. That's always seemed inadequate for addition and similar operations. This has been a question that's puzzled me for some time. Dave Berry, Laboratory for Foundations db%lfcs.ed.ac.uk@nsfnet-relay.ac.uk of Computer Science, Edinburgh Uni. !mcvax!ukc!lfcs!db "leIsANewEntertainment:GuerillaWarStruggleIsANewEntertainment:GuerillaWarStrug"