Hey guys,
I'm getting an error at lines #9 and #14. Could someone tell me what I'm doing wrong?
StackType::StackType(const StackType & st) // copy c-tor
{
if ( st.topPtr == NULL )
topPtr = NULL;
else
{
NodeType * stptr; // pointer to source Stack
NodeType * p; // pointer to target Stack
topPtr = new NodeType(st.topPtr->info); // first node
stptr = st.topPtr->next; // point to second Node
p = topPtr; // initialize pointer to Stack copy
while ( stptr != NULL ) // deep copy other nodes
{
p->next = new NodeType(stptr->info);
p = p->next; // update pointers
stptr = stptr->next;
} // endwhile
p->next = NULL;
} // endif
}