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