home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / modula3 / 841 < prev    next >
Encoding:
Internet Message Format  |  1992-07-20  |  1.8 KB

  1. Xref: sparky comp.lang.modula3:841 comp.lang.misc:2680 comp.lang.c++:11204
  2. Newsgroups: comp.lang.modula3,comp.lang.misc,comp.lang.c++
  3. Path: sparky!uunet!mcsun!fuug!funic!news.cs.hut.fi!news!Ari.Huttunen
  4. From: Ari.Huttunen@hut.fi (Ari Juhani Huttunen)
  5. Subject: Re: Sather's Multiple Inheritance
  6. In-Reply-To: mbk@lyapunov.ucsd.edu's message of 18 Jul 92 01:03:48 GMT
  7. Message-ID: <ARI.HUTTUNEN.92Jul20112548@wonderwoman.hut.fi>
  8. Sender: usenet@cs.hut.fi (Uutis Ankka)
  9. Organization: Helsinki University of Technology, Finland
  10. References: <147qlkINNft3@network.ucsd.edu>
  11. Date: Mon, 20 Jul 1992 09:25:48 GMT
  12. Lines: 33
  13.  
  14. In article <147qlkINNft3@network.ucsd.edu> mbk@lyapunov.ucsd.edu (Matt Kennel) writes:
  15.  
  16. ! Now what if both PARENT_CLASS_ONE and PARENT_CLASS_TWO
  17. ! have two features, say integer variables "count":
  18.  
  19. ! Then you can use "alias new_name old_name":
  20. ! ===========
  21. ! class CHILD is
  22.  
  23. !     PARENT_CLASS_ONE;    --- That inherits it
  24. !     alias count_one count;    --- rename "count" from P_C_O
  25. !     PARENT_CLASS_TWO;    --- That inherits another
  26. !     alias count_two count;    --- Rename that one as well
  27.  
  28. !     count : INT;        --- A third "count" different from the
  29. !                 --- other two.
  30.  
  31. ! end;
  32. ! ============
  33.  
  34. ! I don't know if this solution is perfect for all circumstances, but it
  35. ! appears to a layman to cover a whole lot, and it's very easy to understand.
  36.  
  37. You still have the problem that CHILD, PARENT_CLASS_ONE and PARENT_CLASS_TWO
  38. refer to the same 'count' each, unless you re-rewrite the functions in
  39. the parent classes. (In some cases this would be desirable, in others it
  40. would not.)
  41.  
  42. The problem would be solved, if this were possible: 'rename count_two count'.
  43. --
  44. ...............................................................................
  45. Ari Huttunen                               They say the sky high above
  46. 90-7285944                                   is Caribbean blue...  (Enya)
  47.