/* File: intitem.C integer operations needed for ListNode and List Classes. */ #include #include #include #include "intitem.h" ListItem::ListItem() { /* default constructor */ item = 0 ; } ListItem::ListItem(data x) { /* alternate constructor */ item = x ; } ListItem::~ListItem() { /* destructor */ /* nothing need be done */ } data ListItem::copy() { /* make a copy */ return item ; } /* Compare data in host object with given data. <0 is smaller, =0 is equal, >0 is bigger */ int ListItem::compare(data x) { if (item < x) return -1 ; if (item > x) return 1 ; return 0 ; } void ListItem::print() { /* print to stdout */ printf("%d", item) ; }