Hey,
This is my first post on any forum so please try to bear with me. I've run into an error with my copy constructor. Actually I think the problem is somewhere else.
Set::Set()
{
Count = 0;
Head = new (nothrow) Node;
Head->Next = NULL;
}
// De-initialize the set
//
Set::~Set()
{
Node * Temp1 = Head->Next;
Node * Temp2;
while (Temp1 != NULL)
{
Temp2 = Temp1;
Temp1 = Temp1 -> Next;
delete Temp2;
}
Head -> Next = NULL;
Count = 0;
delete Head;
Head = NULL;
}
// Initialize the set using an existing set
//
Set::Set( const Set& A)
{
Head = new (nothrow) Node;
Head -> Next = NULL;
Node * Temp1 = A.Head->A.Next;
while(Temp1 != NULL)
{
Temp1 = Temp1 -> A.Next;
insert(Temp1->Item);
}
}
Here is part of my interface file where the Node is constructed.
1 2 3 4 5 6 7 8 9 10 11
private:
struct Node
{
int Element; // User data item
Node * Next; // Link to the node's successor
};
unsigned Count; // Number of user data items in the set
Node * Head; // Link to the head of the chain
And here is the error that I get
1 2 3 4
proj08.set.cpp: In copy constructor 'Set::Set(const Set&)':
proj08.set.cpp:46: error: 'struct Set::Node' has no member named 'A'
proj08.set.cpp:50: error: 'struct Set::Node' has no member named 'A'
proj08.set.cpp:51: error: 'struct Set::Node' has no member named 'Item'