// Created by Frank M. Carrano and Tim Henry. // Copyright (c) 2013 __Pearson Education__. All rights reserved. // Section C2.4 #include #include #include "PlainBox.h" #include "MagicBox.h" using namespace std; void placeInBox(PlainBox* theBox, string theItem) { theBox->setItem(theItem); } // end placeInBox int main() { string specialItem = "Riches beyond compare!"; string otherItem = "Hammer"; PlainBox* myPlainBoxPtr = new PlainBox(); placeInBox(myPlainBoxPtr, specialItem); cout << myPlainBoxPtr->getItem() << endl; MagicBox* myMagicBoxPtr = new MagicBox(); placeInBox(myMagicBoxPtr, otherItem); placeInBox(myMagicBoxPtr, specialItem); cout << myMagicBoxPtr->getItem() << endl; delete myPlainBoxPtr; myPlainBoxPtr = nullptr; delete myMagicBoxPtr; myMagicBoxPtr = nullptr; return 0; } // end main /* Riches beyond compare! Hammer */