1: // Created by Frank M. Carrano and Tim Henry. 2: // Copyright (c) 2013 __Pearson Education__. All rights reserved. 4: // Section C4.1.3: is-a demo 6: #include <iostream> 7: #include <string> 8: #include "PlainBox.h" 9: #include "MagicBox.h" 11: using namespace std; 13: void displayBoxItem(PlainBox<string> thing) 14: { 15: cout << "The item stored in the box is " 16: << thing.getItem() << ".\n"; 17: } // end displayBoxItem 19: int main() 20: { 21: PlainBox<string> myPlainBox("Basketball"); 22: MagicBox<string> myMagicBox("Volleyball"); 23: 24: displayBoxItem(myPlainBox); // myPlainBox's item is displayed 25: displayBoxItem(myMagicBox); // myMagicBox's item is displayed 26: 27: return 0; 28: } // end main 30: /* 32: The item stored in the box is Basketball. 33: The item stored in the box is Volleyball. 35: */