Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
COleCurrency::operator +=, -=

COleCurrency::operator +=, -=

Allow you to add and subtract a COleCurrency value to and from this COleCurrency object.

const COleCurrency& operator +=( 
   const COleCurrency& cur  
); 
const COleCurrency& operator -=( 
   const COleCurrency& cur  
);

If either of the operands is null, the status of this COleCurrency object is set to null.

If the arithmetic operation overflows, the status of this COleCurrency object is set to invalid.

If either of the operands is invalid and the other is not null, the status of this COleCurrency object is set to invalid.

For more information on the valid, invalid, and null status values, see the m_status member variable.

// both set to 35.0050
COleCurrency cur1(35, 50);
COleCurrency cur2(35, 50);

// adding 2.0075 results in 37.0125
cur1 += COleCurrency(2, 75);
ASSERT(cur1 == COleCurrency(37, 125));

// subtracting 2.0075 results in 32.9975
cur2 -= COleCurrency(2, 75);
ASSERT(cur2 == COleCurrency(32, 9975));

Header: afxdisp.h

Show:
© 2015 Microsoft