Logo Search packages:      
Sourcecode: kbruch version File versions  Download package

ratio ratio::operator- ( ratio  subtrahend )

operator overloading for: c = object - subtrahend

Definition at line 181 of file ratio.cpp.

References change_sign(), and operator+().

{
    /* this object will be returned as the difference */
    ratio diff (0, 1);

    /* change the sign of the subtrahend, so we can handle it as an addition */
    subtrahend.change_sign();
    diff = operator+ (subtrahend);

    /* we have to change the sign back, so everything will be as before */
    subtrahend.change_sign();

    /* return the difference */
    return diff;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index