Source of ToyBox.cpp


  1: //  Created by Frank M. Carrano and Tim Henry.
  2: //  Copyright (c) 2013 __Pearson Education__. All rights reserved.

  4: /** Listing C1-6.
  5:  @file ToyBox.cpp */

  7: #include "ToyBox.h"

  9: template<class ItemType>
 10: ToyBox<ItemType>::ToyBox()
 11: {
 12:    PlainBox<ItemType>();
 13:    boxColor = BLACK;
 14: }  // end default constructor

 16: template<class ItemType>
 17: ToyBox<ItemType>::ToyBox(const Color& theColor)
 18: {
 19:    PlainBox<ItemType>();
 20:    boxColor = theColor;
 21: }  // end constructor

 23: template<class ItemType>
 24: ToyBox<ItemType>::ToyBox(const ItemType& theItem,
 25:                          const Color& theColor)
 26: {
 27:    PlainBox<ItemType>();
 28:    PlainBox<ItemType>::setItem(theItem);
 29:    boxColor = theColor;
 30: }  // end constructor

 32: template<class ItemType>
 33: Color ToyBox<ItemType>::getColor() const
 34: {
 35:    return boxColor;
 36: }  // end getColor