Source of ListingC1-03.h


  1: //  Created by Frank M. Carrano and Timothy M. Henry.
  2: //  Copyright (c) 2017 Pearson Education, Hoboken, New Jersey.

  4: /** Listing C1-3
  5:     @file PlainBox.h */

  7: #ifndef PLAIN_BOX_
  8: #define PLAIN_BOX_

 10: template<class ItemType> // Indicates this is a template definition

 12: // Declaration for the class PlainBox
 13: class PlainBox
 14: {
 15: private:
 16:    // Data field
 17:    ItemType item;
 18:    
 19: public:
 20:    // Default constructor
 21:    PlainBox();
 22:    
 23:    // Parameterized constructor
 24:    PlainBox(const ItemType& theItem);
 25:    
 26:    // Mutator method that can change the value of the data field
 27:    void setItem(const ItemType& theItem);
 28:    
 29:    // Accessor method to get the value of the data field
 30:    ItemType getItem() const;
 31: }; // end PlainBox

 33: #include "PlainBox.cpp" // Include the implementation file
 34: #endif