Source of ListingC1-01.h


  1: //  Created by Frank M. Carrano and Timothy M. Henry.
  2: //  Copyright (c) 2017 Pearson Education, Hoboken, New Jersey.
  3: /** Listing C1-1
  4:     @file PlainBox.h */
  5:     
  6: #ifndef PLAIN_BOX_
  7: #define PLAIN_BOX_

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

 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:    // Method to change the value of the data field
 27:    void setItem(const ItemType& theItem);
 28:    
 29:    // Method to get the value of the data field
 30:    ItemType getItem() const;
 31: }; // end PlainBox
 32: #endif