Please send questions to
st10@humboldt.edu .
// header for class MyNode ---
// also include typedef for MyNodePtr at the end,
// for convenience...
//
// by: Sharon M. Tuttle
// last modified: 11-19-03 - added example friend function
// and overloaded operators
class MyNode
{
public:
// constructors
MyNode();
MyNode(int newQuant, float newCost);
// accessors
int get_quant() const;
float get_cost() const;
MyNode* get_nextPtr() const;
// mutators
void set_quant(int newQuant);
void set_cost(float newCost);
void set_nextPtr(MyNode *nextNodePtr);
// overloaded operators
MyNode operator +(const MyNode& node2);
bool operator ==(const MyNode& node2);
// other member functions
bool equalQuant(MyNode node2) const;
// friends
friend bool equalCost
(MyNode node1, MyNode node2);
private:
int quant;
float cost;
MyNode *nextPtr;
}; // end class header
// for convenience
typedef MyNode* MyNodePtr;