next up previous contents
Next: The Destructor: Up: Implementation: The Complex_POLY_CELL Class: Previous: Grab and Print Methods:

Constructors:

    // ***************************************************** //
    // default constructor for Complex_POLY class              //
    // ***************************************************** // 
Complex_POLY::Complex_POLY()
{
  head = NULL;
}

    // ****************************************** //
    // explicit constructor for Complex_POLY class  //
    // ****************************************** // 
Complex_POLY::Complex_POLY(Complex x_in, unsigned int q)
{
  head = new Complex_POLY_CELL(x_in,q);
}

     // *************************************************** //
     // copy constructor for Complex_POLY class               //
     // *************************************************** //
Complex_POLY::Complex_POLY(const Complex_POLY& A)
{
   
  Complex_POLY_CELL *temp,*again;

  if(!(A.head==NULL)){
    head = new Complex_POLY_CELL();
    head->element = A.head->element;
    head->power = A.head->power;
    temp = head;
    again = A.head->next;
    while(!(again==NULL)){
      temp->next = new Complex_POLY_CELL();
      temp->next->element = again->element;
      temp->next->power = again->power;
      again = again->next;
      temp = temp->next;
      }
    }    
        
}



Jim Peterson
1999-04-22