home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13698 < prev    next >
Encoding:
Text File  |  1992-09-15  |  1.4 KB  |  47 lines

  1. Newsgroups: comp.lang.c++
  2. From: nikki@trmphrst.demon.co.uk (Nikki Locke)
  3. Path: sparky!uunet!pipex!demon!trmphrst.demon.co.uk!nikki
  4. ReplyTo: nikki@trmphrst.demon.co.uk
  5. Subject: Re: help
  6. References: <1992Sep13.164046.24676@njitgw.njit.edu>
  7. Distribution: world
  8. X-Mailer: cppnews $Revision: 1.16 $
  9. Organization: Trumphurst Ltd.
  10. Lines: 32
  11. Date: Tue, 15 Sep 1992 11:27:18 +0000
  12. Message-ID: <716581638snx@trmphrst.demon.co.uk>
  13. Sender: usenet@gate.demon.co.uk
  14.  
  15.  
  16. In article <1992Sep13.164046.24676@njitgw.njit.edu> jxd7299@hertz.njit.edu (Jing X Ding) writes:
  17.  
  18. >     PROD *A;//PROD is a defined class
  19. >        :
  20. >        :
  21. >     for (...){
  22. >     A=(PROD*)new char [totalprod*sizeof(PROD)];//totalprod is a const
  23. >        :
  24. >        :
  25. >      Place 1
  26. >     }
  27. >      Place 2
  28. > The problem is :(1) Where can I use destructure to free memory (Place 1 or
  29. > Place 2)? (2) How to write the destructure?
  30. That is an interesting corruption of the word "destructor" - meaningful, 
  31. too !
  32.  
  33. What you want is ...
  34. A = new PROD[totalprod];
  35.     :
  36.     :
  37. delete [] A;
  38.  
  39. ---
  40. Nikki Locke              |                        | nikki@trmphrst.demon.co.uk
  41. Trumphurst Ltd.          | Tel: +44 (0)691-670318 | nikki@cix.compulink.co.uk
  42. PC and Unix consultancy  | Fax: +44 (0)691-670316 | nikki@kewill.co.uk
  43. trmphrst.demon.co.uk is NOT affiliated with ANY other sites at demon.co.uk.
  44. Demon.co.uk is a dial-up subscription access point to the Internet.
  45.