7.9.   -                           207

friend polynomial& operator-(const polynomial& a,
const polynomial& b) ;

friend polynomial& operator*(const polynomial& a,
const polynomial& b) ;

friend polynomial& operator/(const polynomial& a,
const polynomial& b) ;

friend polynomial& operator-(const polynomial& a);

friend polynomial& operator+=(const polynomial& a,
const polynomial& b) ;

friend bool operator==(const polynomial& a,
const polynomial& b) ;

friend bool operatori=(const polynomial& a,
const polynomial& b) ;

private:

term* h;

int degree;

void prepend(term* t);

void add_term(term*& a, term*& b) ;

void release() ;

void rest_of(term* rest);

void reverse();

};

 ,          -
    C++.   ,    -
 operator= (), operator+ ()  operator+= ()   =  + b 
    ,    += b.
    operator= ():

polynomial& polynomial::operator=(const polynomial& )
{

if (h != a.h) { //   = 

release(); //    
polynomial* temp = new polynomial(a);

h = temp -> h;

degree = temp -> degree;

}
return *this;

}

      (.  22, 
.226).

7.9.   -   

  ,    ,   -
 ,     .     : ostream& 
,    ostream&.      