smryan@garth.UUCP (Steven Ryan) (09/25/90)
In Smalltalk, if you define, say, methods `a' and `b' such that method `b' uses method `a' as in `self a', the search for the method begins at the original object. In this way, if a subclass redefines `a' and not `b', then in `subobject b', the original `b' uses the subclass's `a' rather than the `a' at the same level. Smalltalk uses `super' to begin the search partway up the search chain rather starting at the bottom. Do Eiffel and C++ provide a similar capabilities? -- ...!uunet!ingr!apd!smryan Steven Ryan ...!{apple|pyramid}!garth!smryan 2400 Geng Road, Palo Alto, CA
kimr@eiffel.UUCP (Kim Rochat) (09/26/90)
In article <11@garth.UUCP>, smryan@garth.UUCP (Steven Ryan) writes: > In Smalltalk, if you define, say, methods `a' and `b' such that method `b' uses > method `a' as in `self a', the search for the method begins at the original > object. In this way, if a subclass redefines `a' and not `b', then in > `subobject b', the original `b' uses the subclass's `a' rather than the `a' > at the same level. > > Smalltalk uses `super' to begin the search partway up the search chain > rather starting at the bottom. > > Do Eiffel and C++ provide a similar capabilities? > -- Dynamic binding in Eiffel operates as you describe above. If an Eiffel feature (method) is redefined by a class, it conceals the name of the inherited feature. If the inherited feature has been renamed, it can still be accessed by using the new name. If a class redefines an inherited feature and does not provide an alternate name for the previous definition of the feature, then the previous definition of the feature is not directly available to subclasses of that class. However... Repeated (multiple) inheritance can be used by any subclass to directly inherit from the class providing the desired definition of the feature. Renaming is used to remove any conflict introduced by inheriting a feature having having the same name from two different classes. So, in Eiffel, any previous definition of a feature can be accessed by directly inheriting from a class containing the desired definition. There is no notion of 'super' in the sense of 'provide the previous definition of the feature having this name'. Kim Rochat Interactive Software Engineering Responses to: eiffel@eiffel.com