COleCurrency::operator +=, -=

允许您向/从此 COleCurrency 对象增加和减少 COleCurrency 值。

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

备注

如果操作数之一为空,则此 COleCurrency 对象的状态设置为null。

如果算术运算溢出,此 COleCurrency 对象的状态设置为无效。

如果操作数之一而无效,另一个则不为空,则此 COleCurrency 对象的状态设置为无效。

有关有效的更多信息,void和null状态值,请参见 m_status 成员变量。

示例

// 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

请参见

参考

COleCurrency Class

层次结构图

COleCurrency::operator +, -

COleCurrency::GetStatus