//Copy constructor

BitArray::BitArray(const BitArray & Rhs)
{
  ArraySize = Rhs.ArraySize;
  TheArray = new int[ArraySize];
  N = Rhs.N;

  for (int i =0; i < ArraySize; i++) 
    TheArray[ i ] = Rhs.TheArray[ i ];
}

//Copy assignment

const BitArray &
BitArray::operator=(const BitArray & Rhs)
{
  if (this != &Rhs)
    {
      if (ArraySize < Rhs.ArraySize)
	{ //not enough space, extend BitArray
	  delete [] BitArray;
	  ArraySize = Rhs.ArraySize;
	  N = Rhs.N;
	  BitArray = new int [ArraySize];
	}
      
      for (int i =0; i < ArraySize; i++) 
	TheArray[ i ] = Rhs.TheArray[ i ]; //wrong in book

    }

  return *this;
}


//FIGURES 2.14 and 2.15