1: // Created by Frank M. Carrano and Timothy M. Henry. 2: // Copyright (c) 2017 Pearson Education, Hoboken, New Jersey. 4: template<class ItemType> 5: void MagicBox<ItemType>::setItem(const ItemType& theItem) 6: { 7: if (!firstItemStored) 8: { 9: PlainBox<ItemType>::item = theItem; // item has protected access 10: firstItemStored = true; // Box now has magic 11: } // end if 12: } // end setItem