Source of PlainBox.h


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

  4: /** Listing C1-1
  5:     @file PlainBox.h */
  6:     
  7: #ifndef _PLAIN_BOX
  8: #define _PLAIN_BOX

 10: // Set the type of data stored in the box
 11: typedef double ItemType;

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