Source of Entry.h


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

  4: /** A class of entry objects for an array-based implementation of the ADT dictionary.
  5:     Listing 18-2.
  6:  @file Entry.h */

  8: #ifndef _ENTRY
  9: #define _ENTRY

 11: template <class KeyType, class ItemType>
 12: class Entry
 13: {
 14: private:
 15:    ItemType item;
 16:    KeyType searchKey;
 17:    
 18: protected:
 19:    void setKey(const KeyType& searchKey);
 20:    
 21: public:
 22:    Entry();
 23:    Entry(ItemType newEntry, KeyType searchKey);
 24:    ItemType getItem() const;
 25:    KeyType getKey() const;
 26:    void setItem(const ItemType& newEntry);
 27:    bool operator==(const Entry<KeyType, ItemType>& rightHandItem) const;
 28:    bool operator>(const Entry<KeyType, ItemType>& rightHandItem) const;
 29: }; // end Entry

 31: #include "Entry.cpp"
 32: #endif