home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!europa.asd.contel.com!emory!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!network.ucsd.edu!ucsbcsl!ucsb.edu
- From: ambuj@ucsb.edu (Singh)
- Newsgroups: comp.lang.eiffel
- Subject: repeated inheritance and renaming
- Message-ID: <6546@ucsbcsl.ucsb.edu>
- Date: 6 Nov 92 00:47:37 GMT
- Sender: root@ucsbcsl.ucsb.edu
- Organization: University of California, Santa Barbara
- Lines: 55
-
-
- I have the following question regarding repeated
- inheritance and renaming in Eiffel.
-
- Suppose I have the following classes:
-
- class R
- feature
- x:integer;
- f is do
- x := x+1;
- end;
- end
-
-
- class A class B class C
- inherit inherit inherit
- R redefine f; R rename x as xB R
- feature end end
- f is do
- x := x + 2;
- end;
- end
-
- class S
- inherit
- A rename f as fA;
- B rename f as fB;
- C;
- feature
- Create is
- do
- fB;
- io.putint(xB); io.new_line;
- end;
- end
-
- Assume that class S is the ``root'' class of the system.
- Upon activation of S.create,
- I would have expected procedure fB to update xB and
- the subsequent print statement to print 1.
- However, it seems that fB updates x instead of xB
- and 0 is the value printed.
- I also find that if S does not inherit from A then the
- expected happens and 1 gets printed.
- What am I missing? Is this a problem with the installation
- of Eiffel?
-
- Thanks.
-
- Ambuj Singh
- Dept. of Computer Science
- University of California
- Santa Barbara, CA 93106
- ambuj@cs.ucsb.edu
-