Due: 3/1/01
Purpose: create a completely generalize container class.
Capabilities:
CNode
class CData: public CNode
In Program 5 you hard coded the Nodes to contain an int. For Program
#7 this int m_data MUST be removed from the Node specification. Your
Node will look something like the following:
class Node
{
public:
Node();
virtual bool operator<( Node & rhs ) = 0;
virtual bool operator==( Node & rhs ) = 0;
virtual ~Node() {};
Node * next;
Node * prev;
};
A sample Find function showing how to use a virtual function (in this case operator==).
bool CBag::Find( Node *pNode )
{
Node *pTempNode = m_pHead;
while( pTempNode )
{
if( *pTempNode == *pNode )
{
return( true
);
}
pTempNode = pTempNode->next;
}
return( false );
}