home *** CD-ROM | disk | FTP | other *** search
/ C by Discovery (4th Edition) / C_By_Discovery_4th_Edition.tar / C_By_Discovery_4th_Edition / CH_12 / 694.jpg < prev    next >
Joint Photographic Experts Group Image  |  2013-12-12  |  621KB  |  2550x3300
Labels: book | poster | reckoner
OCR: 694 Chapter Discovering C++ It should be noted that class Po int does not need destructor. There nothing ir the class that needs cleaning up when Poi int object is destroyed destructor IS needed when the constructor does something that needs cleanup Examples of such actions would be dynamically allocating memory opening file The destructor should de-allocate the memory close the fi The following ex ample demonstrates class that has both constructors and destructor. The class represents an item in inventory. It is simplified version 1 that the only information we are keeping about an item identification string), and the number in inventory (an int Example 12-8 invItem.h invItem h Declarat: .on of the inv Item class invItem public: invItem Note 2 PRECONDI ITION none POSTCONDITION: The data m ...