Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!pacbell.com!ucsd!sdcc6!uape_5!cs162sbj From: cs162sbj@uape_5.ucsd.edu (....What Is?....) Newsgroups: comp.lang.c++ Subject: Object pointers, and destructors Message-ID: <19944@sdcc6.ucsd.edu> Date: 31 May 91 11:16:49 GMT Sender: news@sdcc6.ucsd.edu Distribution: comp Organization: University of California, San Diego Lines: 23 I've become a pretty good beginner at C++ & am ready to move on to intermediate. Before I do, I need some clarifications on C++ that I haven't been able to find in the books I've read. They might be dumb questions, or may have been thoroughly discussed, but here goes anyways. [1] Why aren't pointers hidden/protected/controlled/etc. the way class objects are? I was doing a symbol table for a class project which kept reference counts on all the objects & the objects that they pointed to, and a single pointer assignment in the "main program" from a pointer returned by a member function to a new pointer is enough to throw the reference count off. I want to be able to control pointer assignments the way I can control object assignments, but I haven't been able to overload operators using pointers to objects, just objects. How is what I want to do accomplished cleanly? [2] Why doesn't delete() automatically set the original pointer to NULL? I can't do it from within my destructor, and I can find no reason to leave it pointing to freed memory. Steven Boswell whatis@ucsd.edu