Source of Listing18-2.h


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

  4: // Listing 18-2.

  6: /** A class of entries to add to an array-based implementation of the ADT dictionary.
  7:  @file Entry.h */

  9: #ifndef ENTRY_
 10: #define ENTRY_

 12: template <class KeyType, class ValueType>
 13: class Entry
 14: {
 15: private:
 16:    KeyType   key;
 17:    ValueType value;
 18:    
 19: protected:
 20:    void setKey(const KeyType& searchKey);
 21:    
 22: public:
 23:    Entry();
 24:    Entry(const KeyType& searchKey, const ValueType& newValue);
 25:    ValueType getValue() const;
 26:    KeyType getKey() const;
 27:    void setValue(const ValueType& newValue);
 28:    bool operator==(const Entry<KeyType, ValueType>& rightHandValue) const;
 29:    bool operator>(const Entry<KeyType, ValueType>& rightHandValue) const;
 30: }; // end Entry

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