Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!know!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!emory!hubcap!gatech!rutgers!att!drutx!weh@dryer.ATT.COM From: weh@dryer.ATT.COM (XGPB30000-HopkinsWE(DR9274)237) Newsgroups: comp.lang.c++ Subject: Re: Whats wrong with this picture (or am I slow?) Message-ID: <6339@drutx.ATT.COM> Date: 12 Oct 90 15:46:04 GMT References: <90284.103929EACONS@MTUS5.BITNET> Sender: news@drutx.ATT.COM Reply-To: weh@dryer.ATT.COM Lines: 34 From article <90284.103929EACONS@MTUS5.BITNET>, by EACONS@MTUS5.BITNET (Ernie Anderson): > Thanks to all who responded by email to my question. The message I heard > over and over was about the = operator being overloaded to take care of > deallocating the memory. That is what I had been thinking, but the book's > example did not redefine it. I'm relieved that I wasn't just being paranoid. > I'm a little disappointed with the text, they shouldn't have done something > as negligent as that, even for an example. At least they could have put a > note afterward pointing out the flaw. Anyway, I'll shelve that one for now > and just work with my Lippman text. Thanks again everyone. My original response must have been lost. You shouldn't be disappointed with the Dewhurst and Stark book because they *did* overload operator = in chapter 4 (section 4.2 titled ``Strings'', pg. 80, first printing). I surmise that they did not include the overloaded = in the previous chapter to simplify the initial presentation of a String class. The more refined example in chapter 4 includes the use of a separate representation class and reference counting. It seems that to shelve a book because an example didn't do all it should have is a bit rash. In this case, it is a matter of the authors refining a example as they build up familiarity with the concepts. Dewhurst and Stark's book has the nice property of giving a relatively quick and practical introduction to the features (and the use thereof) that C++ introduced in addition to what was already part of C. Lippman's book is a more comprehensive text, taking the reader from ground zero to multiple inheritance and pointers to members. The details are carefully explained and illustrated. Both are excellent books but with different purposes. Bill Hopkins AT&T Bell Labs 11900 N. Pecos St. Denver, CO 80234 w.e.hopkins@att.com