Untitled
unknown
plain_text
4 years ago
572 B
9
Indexable
#include <iostream>
#include <string>
#include "ItemType.h"
#include <fstream>
using namespace std;
// constructor
ItemType::ItemType() {
value = 0;
}
// returns GREATER, LESS, or EQUAL
Comparison ItemType::compareTo(ItemType item) {
if (value == item.value) {
return EQUAL;
} else if (value > item.value) {
return GREATER;
} else {
return LESS;
}
}
// returns the value
int ItemType::getValue() const {
return value;
}
// initializes the value to a given number
void ItemType::initialize(int num) {
value = num;
}
Editor is loading...