Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!munnari.oz.au!goanna!wren!ajk From: ajk@wren.cs.rmit.OZ.AU (Alan Kent) Newsgroups: comp.lang.eiffel Subject: Simple Eiffel Feature Call Question Message-ID: <5583@goanna.cs.rmit.oz.au> Date: 7 May 91 03:10:58 GMT Sender: news@goanna.cs.rmit.oz.au Lines: 36 This may be a naive question, but I dont have a compiler installed here at the moment to experiment with. I am having a little trouble working out how to handle each of the following three cases in Eiffel. Consider three classes A, B and C where (the syntax might not be quite right) class A export f ... class B export f inherit A redefine f ... class C export f inherit B redefine f ... Assume Current is an instance of class C. In feature f of class B I would like to be able to... (1) Call version C of method f (the definition in the class of the object) (2) Call version B of method f (the definition in the current class) (3) Call version A of method f (the parent's definition) As I understand Eiffel, it will always do approach (1). The reason I would like to be able to do (2) is for recursion. I dont want my definition of a recursive algorithm in B to be changed by some decendant class. The only way I can think of doing this is to make f call another feature f_secret where f_secret is not exported (and so can be recursive safely). The reason I would like to be able to do (3) is that my decendant class just wants to add a little bit more to the parent class routine definition. The only way I can see of doing this is by copying the parent routine definition in the child with the few extra lines I want added. In other languages that I know of this is achieved using a keyword like "super". Renaming does not seem to do what I want eg: class C export f, B_f inherit B rename f as B_f as I can no longer invoke version C of feature f when the type is B or A (ie. its no longer a redefine). Am I missing something, in particular with case (3)? Thanks. Alan Kent ajk@goanna.cs.rmit.oz.au