This may not solve your exact issue, but if you have the functions you mentioned, then pseudo-code to a copy constructor would look like this.
List::List(const List& b)
{
Node *headNode = b.getHeadNode();
while (headNode != NULL)
{
push_back(headNode->getDataFromNode());
headNode = headNode->getNextNode();
}
}
So basically, that in a nutshell is the entire copy constructor. You're basically starting from the first node in the list, getting the data from that node, and calling your push_back() to add the new data. I'm assuming that push_back() does all of the tricky work of creating a node, adding the data to it, and placing it correctly at the back of the list.
Note how small, compact, and intuitive this implementation is. We know that all we need to do to create a copy of a linked list is to first make sure the list is empty (which it is for a new object), and keep adding the items from the old list to the new list. Since push_back() adds an item to a list (and has all the complexity of creating a node and linking it to the end node), we use it in a smart way to create our copy.
Note that you also need an assignment operator to go along with the copy constructor. The assignment operator in the example is simply calling clear() (if you have such a function) to remove all the nodes before proceeding.
Remember that all of this requires that your push_back() function works flawlessly. It should know how to properly handle inserting at the end of an empty and non-empty list.
Edit:
If your driver code does create the new node before the push_back (therefore push_back doesn't allocate the new node), then the alternative code can be used:
List::List(const List& b)
{
Node *headNode = b.getHeadNode();
while (headNode != NULL)
{
Node *newNode = new Node(headNode->getDataFromNode());
push_back(newNode);
headNode = headNode->getNextNode();
}
}
In the alternate version, I'm assuming that the constructor for the new node can be created with the data as an argument. I personally don't like the design of having push_back() not do all of the work of creating the node, but that's another issue.