My first post here...i'm just starting out with C++ and am stuck on a project. any advice will be appreciated...here's the code :
Code:
Bag::Bag(const Bag &aBag): size(aBag.size())
{
if(aBag.head == NULL)
head=NULL;
else
{
head =
new Node;
assert(head != NULL);
head->value = aBag.head->value;
head->prev = NULL;//////////IS THIS CORREECT???
Node *newptr = head;
for (Node *origPtr = aBag.head->next;origPtr != NULL; origPtr = origPtr->next)
{
newPtr->next =
new Node;
assert(newPtr->next != NULL);
newPtr = newPtr->next;
newPtr->value = origPtr->value;
newPtr->prev = origPtr->prev; //////// IS THIS THE RIGHT WAY???
}
newPtr->next = NULL;
}
}
where....
struct
Node
{
ItemType value;
Node *next;
Node *prev;
};
Node *head;
ALSO IF SOME1 COULD OUTLINE AN ASSIGNMENT OPERATOR FOR THE SAME CLASS,I'D BE GREATFUL...THANKS AND TAKE CARE!

