????1???ò????????÷????

????????????????????????????÷???????????????????????????????Ч????????????????????????????????

?????????′???


class Rational{
public:
    Raional( int numerator = 0?? int denominator =1);
    ...
private:
    int d?? d;
    friend Rational operator* (const Rational& lhs?? const Raional& rhs) ;
};
Rational Rational::operator* (const Rational& lhs??const Raionl&rhs)
{
        return Rational  result(lhs.n*rhs.n??lhs.d*rhs.d);
   }
}


?????????????????????????????????????????????????????????????????????????????????????????????????Ч????

??????????????????????????????????????statck???д??????????????heep???д?????


People p(a??b)                  //??д???
People *p = new People(a??b)   //???д???


???????????????????д?????????????????????????????????????????????????????


const Rational& operator* (const Rational& lhs?? const Rational & rhs)
{
      Rational  result(lhs.n*rhs.n??lhs.d*rhs.d);
      return result;
}


?????????????stack?????????????????????κκ???????????????????????????????????????????????????????????????????????ζ??reference?????????????

???????????????д???


const Rational& operator* (const Rational& lhs?? const Rational & rhs)
{
     Rational*  result=new Rational(lhs.n*rhs.n??lhs.d*rhs.d);
     return *result;
}


??????????????????????new??????????????delete?????????????????????????????


Rational w??x??y??z;
w=x*y*z;


?????????????????????????operator*????ζ??new?????Σ?????delete???Ρ???????????к???????opertaor*??????????Щdelete?????????????????????????????????????й???

???????????????????????????????????????static Rational????


const Rational & operator*(const Rational& lhs??const Rational & rhs)
{
    static Rational result;
    result = ...;
    return result;
}


??????????????????????????????£?????д??????????????????????????′??????????


bool operator == (const Rational& lhs?? const Rational&  rhs);

...

Raional a??b??c??d;
if((a*b) == (c*d)
{
     ...
}


????????if??????????a??b??c??d????????true???????????????????????