1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#ifndef STATEPAIR
#define STATEPAIR
template<typename T1, typename T2>
class StatePair {
// TODO: Define a constructor, mutators, and accessors
// for StatePair
public:
StatePair();
StatePair(T1 userKey, T2 userValue);
void SetKey(T1 newKey);
void SetValue(T2 newVal);
T1 GetKey();
T2 GetValue();
void PrintInfo();
private:
T1 key;
T2 value;
// TODO: Define PrintInfo() method
};
template<typename T1, typename T2>
StatePair<T1, T2>::StatePair() {
}
template<typename T1, typename T2>
StatePair<T1, T2>::StatePair(T1 userKey, T2 userValue) {
key = userKey;
value = userValue;
}
template<typename T1, typename T2>
void StatePair<T1, T2>::SetKey(T1 newKey) {
key = newKey;
}
template<typename T1, typename T2>
void StatePair<T1, T2>::SetValue(T2 newVal) {
value = newVal;
}
template<typename T1, typename T2>
T1 StatePair<T1, T2>::GetKey() {
return key;
}
template<typename T1, typename T2>
void StatePair<T1, T2>::PrintInfo() {
std::cout << key << ": " << value << std::endl;
}
#endif
|