0

I can't seem to figure out why there is a segmentation fault in my copy constructor.

Set::Set()
{
   Num = 0;
   Head = new (nothrow) Node;
   Head->Succ = NULL;
}
Set::Set( const Set & A)
{
   Node * Temp = A.Head->Succ;
   while ((Temp) )
   {
      insert(Temp->Item);
      Temp = Temp->Succ;
   }
}
2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Ancient Dragon
0

The problem is the constructor with the parameter. It also needs to initialize instance variables because the constructor with no parameters does not get called.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.