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

  1. Path: sparky!uunet!mcsun!sunic!hagbard!loglule!jbn
  2. From: jbn@lulea.trab.se (Johan Bengtsson)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Should I use a generic object which all others inherit from
  5. Message-ID: <5242@holden.lulea.trab.se>
  6. Date: 20 Nov 92 11:39:47 GMT
  7. References: <1992Nov19.165529.23862@informix.com>
  8. Organization: Telia Research AB, Aurorum 6, 951 75 Lulea, Sweden
  9. Lines: 68
  10. X-Newsreader: Tin 1.1 PL4
  11.  
  12. cshaver@informix.com (Craig Shaver) writes:
  13. : In article <5232@holden.lulea.trab.se> jbn@lulea.trab.se (Johan Bengtsson) writes:
  14. : >cshaver@informix.com (Craig Shaver) writes:
  15. : >: In article <3762@news.cerf.net> hlf@nic.cerf.net (Howard Ferguson) writes:
  16. : .......   blah blah blah
  17. : >: performance go all the way and use the tree approach as pioneered by
  18. : ........  blah blah blah
  19. : >: 
  20. : >: One of the big wins of OOP is reuse.  By using an inheritance structure
  21. : >: you can reuse existing code and do incremental development.  Related and
  22. : >: unrelated classes can be used in the same context where a similar protocol
  23. : >: is enforced.
  24. : >
  25. : >If I go for the tree approach, with a base class MyObject inherited
  26. : YourObject is worthless, just use MyObject....
  27.  
  28. Yes, but from my point of view... (:-)
  29.  
  30. : >by all my classes, how am I going to reuse _your_ classes, which all
  31. : >inherit from class YourObject?  Multiple inheritance?  What
  32. : Use delegation instead of MI ...
  33.  
  34. OK, that works (I won't mention performance).
  35.  
  36. : >How do I reuse tree-type libraries from several sources, each with
  37. : >it's own base class protocol?
  38. : You don't!  C++ bites it bigtime because of a lack of the one thing
  39. : that would really make it good -- a standard base class library.
  40.  
  41. Agreed, but you may want to use a few non-standard but nevertheless
  42. good libraries.  Besides, standards are relative things.  You don't
  43. always need to adhere to worldwide standards, sometimes standard
  44. libraries within a corporation is enough.  Easy combination of the
  45. corparations standard libraries with commercial libraries is an import
  46. issue, I imagine.
  47.  
  48. : >Enforcing a common protocol (by inheritance) for all your classes,
  49. : >_hampers_ reuse of your classes by anyone except yourself.
  50. : Hold on there pardner!  Start your own branch if you don't like mine.
  51. : Trim the damn tree, make sure you have access to all source for classes.
  52.  
  53. Yes, if you are prepared to use the old hack-it-in-the-editor approach
  54. to reuse, then sure, no problem.  Updates of the reused classes will
  55. be a pain to handle for you.  Being able to reuse without source
  56. code changes to working code is a major advantage of O-O languages.
  57. Do you want to throw that away?
  58.  
  59. : This statement sounds bogus.  What is your point?
  60.  
  61. Let others work for you.  Reuse without touching their code, even
  62. if you have it (bugs aside).
  63.  
  64. : >Once a reference to an object has been passed as a generic
  65. : >object reference, for example into a collection, how do you (safely)
  66. : >call the actual methods of the objects (derived) class?
  67.  
  68. You didn't answer on that one...
  69.  
  70. -- 
  71. --------------------------------------------------------------------------
  72. | Johan Bengtsson, Telia Research AB, Aurorum 6, S-951 75 Lulea, Sweden  |
  73. | Johan.Bengtsson@lulea.trab.se; Voice:(+46)92075471; Fax:(+46)92075490  |
  74. --------------------------------------------------------------------------
  75.