1: // Created by Frank M. Carrano and Timothy M. Henry. 2: // Copyright (c) 2017 Pearson Education, Hoboken, New Jersey. 4: /** @file GoodMemory.cpp 5: Listing C2-3 */ 6: #include "GoodMemory.h" 8: GoodMemory::GoodMemory() : someBoxPtr(nullptr) 9: { 10: } // end default constructor 12: GoodMemory::~GoodMemory() 13: { 14: delete someBoxPtr; 15: } // end destructor 17: void GoodMemory::unleakyMethod(const double& someItem) 18: { 19: someBoxPtr = new ToyBox<double>(); 20: someBoxPtr->setItem(someItem); 21: } // end unleakyMethod