|
|
|
|
|
|
|
typedef NodeType* NodePtr;
struct NodeType
{
CardType card;
NodePtr link;
};
// Private members of class:
// NodePtr head; External pointer to linked list
// int listLength; Current length of list
//******************************************************************
CardPile::CardPile()
// Constructor
// Postcondition:
// head == NULL && listLength == 0
{
head = NULL;
listLength = 0;
}
//******************************************************************
CardPile::CardPile( const CardPile& otherPile )
// Copy-constructor
// Postcondition:
// listLength == otherPile.listLength
// && IF otherPile.head == NULL
// head == NULL
// ELSE
// head points to a new linked list that is a copy of
// the linked list pointed to by otherPile.head
{
NodePtr toPtr; // Pointer into new list being built
NodePtr fromPtr; // Pointer into list being copied from |
|
|
|
|
|