home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / cplus / 16580 < prev    next >
Encoding:
Internet Message Format  |  1992-11-19  |  2.7 KB

  1. Path: sparky!uunet!olivea!gossip.pyramid.com!pyramid!infmx!cshaver
  2. From: cshaver@informix.com (Craig Shaver)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Should I use a generic object which all others inherit from
  5. Message-ID: <1992Nov19.165529.23862@informix.com>
  6. Date: 19 Nov 92 16:55:29 GMT
  7. References: <1992Nov17.190821.18348@informix.com> <5232@holden.lulea.trab.se>
  8. Sender: news@informix.com (Usenet News)
  9. Organization: Informix Software, Inc.
  10. Lines: 60
  11.  
  12. In article <5232@holden.lulea.trab.se> jbn@lulea.trab.se (Johan Bengtsson) writes:
  13. >cshaver@informix.com (Craig Shaver) writes:
  14. >: In article <3762@news.cerf.net> hlf@nic.cerf.net (Howard Ferguson) writes:
  15. .......   blah blah blah
  16. >: performance go all the way and use the tree approach as pioneered by
  17. ........  blah blah blah
  18. >: 
  19. >: One of the big wins of OOP is reuse.  By using an inheritance structure
  20. >: you can reuse existing code and do incremental development.  Related and
  21. >: unrelated classes can be used in the same context where a similar protocol
  22. >: is enforced.
  23. >
  24. >Perhaps you would then kindly enlighten the rest of us:
  25.  
  26. OK!
  27.  
  28. >
  29. >If I go for the tree approach, with a base class MyObject inherited
  30.  
  31. YourObject is worthless, just use MyObject....
  32.  
  33. >by all my classes, how am I going to reuse _your_ classes, which all
  34. >inherit from class YourObject?  Multiple inheritance?  What
  35.  
  36. Use delegation instead of MI ...
  37.  
  38. >if the protocol of my base class conflicts with your base class?
  39. >How do I reuse tree-type libraries from several sources, each with
  40. >it's own base class protocol?
  41.  
  42. You don't!  C++ bites it bigtime because of a lack of the one thing
  43. that would really make it good -- a standard base class library.
  44.  
  45. >
  46. >Enforcing a common protocol (by inheritance) for all your classes,
  47. >_hampers_ reuse of your classes by anyone except yourself.
  48.  
  49. Hold on there pardner!  Start your own branch if you don't like mine.
  50. Trim the damn tree, make sure you have access to all source for classes.
  51. This statement sounds bogus.  What is your point?
  52.  
  53. >
  54. >Once a reference to an object has been passed as a generic
  55. >object reference, for example into a collection, how do you (safely)
  56. >call the actual methods of the objects (derived) class?
  57. >
  58. >-- 
  59. >--------------------------------------------------------------------------
  60. >| Johan Bengtsson, Telia Research AB, Aurorum 6, S-951 75 Lulea, Sweden  |
  61. >| Johan.Bengtsson@lulea.trab.se; Voice:(+46)92075471; Fax:(+46)92075490  |
  62. >--------------------------------------------------------------------------
  63.  
  64. Soooooo, give me your rebuttal in terms of flat class hierarchy and let me
  65. attack you.  Templates are useless and should be removed from the language.
  66.  
  67. Craig.......
  68.  
  69. -- 
  70. Craig Shaver  (cshaver@informix.com for now) (415)390-0654 (415)926-6407
  71. Productivity Group POB 60458 Sunnyvale, CA  94088
  72.