home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13410 < prev    next >
Encoding:
Internet Message Format  |  1992-09-08  |  1.8 KB

  1. Path: sparky!uunet!pipex!unipalm!uknet!mcsun!sunic!seunet!abbaut!dlarsson
  2. From: dlarsson@aut.abb.se (Daniel Larsson)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Renaming
  5. Message-ID: <1992Sep8.183745.555@aut.abb.se>
  6. Date: 8 Sep 92 18:37:45 GMT
  7. References: <ETNKNA.92Sep7212951@hisoy2.etn.ericsson.se>
  8. Distribution: comp
  9. Organization: ABB Automation AB, Vasteras, Sweden
  10. Lines: 36
  11.  
  12. In article <ETNKNA.92Sep7212951@hisoy2.etn.ericsson.se> etnkna@hisoy2.etn.ericsson.se (Aksnes Knut-Havard) writes:
  13. >
  14. >...
  15. >
  16. >ARM Section 10.11c suggest  a renaming mechanism to be used when two
  17. >class hierarchies are merged by a common derived class, where the same
  18. >name is used in both hierarchies, but with different semantics. 
  19. >
  20. >Such a renaming scheme is of interest in another situation too;
  21. >sometimes you want to inherit the same class twice, the classical
  22. >example is an implementation of a sparse matrix using linked lists,
  23. >each element shall be in one row list and one column list. Deriving
  24. >linked list twice is not allowed; There are no way to access the
  25. >members of the two parent classes in a unambiguous way.
  26. >
  27.  
  28. A relevant question to ask here is whether a matrix *is* two lists or
  29. *contains* two lists. I would answer it consists of two list, i.e. we
  30. have an aggregate relationship rather than a subtype ditto.
  31.  
  32. >A kludge around this problem is to generate a dummy class inherited
  33. >from the parent class and derive both the parent class and the dummy.
  34. >The problem with this kludge is that it clobbers the global name
  35. >space.
  36. >
  37.  
  38. Why not simply have two members of type list?
  39.  
  40.  
  41.  
  42.  
  43. -- 
  44. ---------------------------------------------------------------------------
  45. Daniel Larsson          Email:       dlarsson@aut.abb.se
  46. ABB Automation AB    Telefax:   +46 21 34 25 25
  47. V{ster}s, Sweden    Telephone: +46 21 34 30 29
  48.