From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1108a1,c52c30d32b866eae X-Google-Attributes: gid1108a1,public X-Google-Thread: 103376,2ea02452876a15e1 X-Google-Attributes: gid103376,public X-Google-Thread: fac41,c52c30d32b866eae X-Google-Attributes: gidfac41,public From: Jacob Gore Subject: Re: Real OO Date: 1996/04/11 Message-ID: <4khlec$v2u@Sahara.enmu.edu>#1/1 X-Deja-AN: 146838179 distribution: world references: <4kbqun$iiv@watnews1.watson.ibm.com> organization: Eastern New Mexico University newsgroups: comp.lang.eiffel,comp.lang.ada,comp.object Date: 1996-04-11T00:00:00+00:00 List-Id: Norman H. Cohen writes > What does Eiffel do in the case of a call like > A.Corresponding_Parts_Equal(B) where A and B have different dynamic > types, but the version of Corresponding_Parts_Equal for the dynamic type > of A expects the parameter to be of (or descendended from) the dynamic > type of Current? You would declare the function corresponding_parts_equal as follows: corresponding_parts_equal(other: like Current): BOOLEAN is ... This can appear in the text of A's class, or in the text of a class that A's class inherits (directly or indirectly). "other: like Current" means that the static type of `other' is Current's (in your example, A's) class. For example, suppose class Z inherits from class Y, which inherits from class X, where the function corresponding_parts_equal is defined (and neither Y nor Z redefine it). The above declaration, as inherited by Z, is shorthand for the redefinition corresponding_parts_equal(other: Z): BOOLEAN is ... same body. That means that `other' can be an object of class Z or any of its subclasses. This does what you asked, doesn't it? Jacob --- Jacob Gore, Eastern NM U. Jacob.Gore@ENMU.Edu | Jacob@ToolCASE.Com