home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / cplus / 17869 < prev    next >
Encoding:
Text File  |  1992-12-12  |  2.6 KB  |  67 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
  3. From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
  4. Subject: Re: Need help implementic data structures of generic objects
  5. Message-ID: <1992Dec12.192752.21791@ucc.su.OZ.AU>
  6. Sender: news@ucc.su.OZ.AU
  7. Nntp-Posting-Host: extro.ucc.su.oz.au
  8. Organization: MAXTAL P/L C/- University Computing Centre, Sydney
  9. References: <42186@sdcc12.ucsd.edu> <1992Dec10.114636.16861@ucc.su.OZ.AU> <1992Dec11.233253.27540@informix.com>
  10. Date: Sat, 12 Dec 1992 19:27:52 GMT
  11. Lines: 54
  12.  
  13. In article <1992Dec11.233253.27540@informix.com> cshaver@informix.com (Craig Shaver) writes:
  14. >In article <1992Dec10.114636.16861@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
  15. >>In article <42186@sdcc12.ucsd.edu> cs161feu@sdcc10.ucsd.edu (Anthony Minkoff) writes:
  16. >>>Hi.  Another question from a C++ neophyte.
  17. >>>
  18. >....
  19. >>>The approach that has been
  20. >>>suggested is:
  21. >>>
  22. >>>class Object {
  23. >>>    /* ...etc... */
  24. >>>};
  25. >>
  26. >>    Dont do this Smalltalk hack please. A queue of Objects is
  27. >>totally useless, since they are just Objects and not ever Widgets.
  28. >
  29. >YES! Do that elegant Smalltalk thing.  Do not listen to C++ hacks and
  30. >bigots.  Put a little thought into it and do something (re)useful.
  31. >
  32.  
  33.     If you want to do this, go ahead, but do it in the language
  34. designed for it - Smalltalk. Trying to emulate Stalk in C++ will
  35. bring grief, if you dont believe me look at some Smalltalk derived
  36. C++ libraries.
  37.  
  38.     C++ has a different philosophy than Stalk, and I humbly
  39. suggest its better to try to understand this philosohpy and use
  40. it to best advantage than attempt to emulate a diametrically opposed
  41. one.
  42.  
  43.     If you follow the Stalk root object method in C++ you will
  44. have to downcast, if the root is a virtual base this is currently
  45. illegal. Even when it becomes legal, it is not a recommended
  46. procedure---it is inherently unsafe. Casting is not provided for
  47. ordinary programming tasks: its better to use the strong typing
  48. system than bypass it with casts.
  49.  
  50.     Try reading The C++ Programming Language (second edition) 
  51. by Bjarne Stroustrup. Especially Ch 12 and 13.
  52.  
  53.     Try using templates for containers.
  54.  
  55.     Try using multiple inheritance, abstraction, 
  56. and virtual bases (even mixins if your compiler supports them).
  57.  
  58.     There is a great richness of ideas in C++, if you
  59. run out, read Coplien :-) Then try to figure out mixins,
  60. no one has written a book on that yet.
  61.  
  62. -- 
  63. ;----------------------------------------------------------------------
  64.         JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
  65.     Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
  66. ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
  67.