COleCurrency::operator =

这些重载赋值运算符的内容货币值添加到此 COleCurrency 对象。

const COleCurrency& operator =(
   CURRENCY cySrc 
);
const COleCurrency& operator =(
   const COleCurrency& curSrc 
);
const COleCurrency& operator =(
   const VARIANT& varSrc 
);

备注

每个运算符的简短声明如下:

  • operator =( cySrc )CURRENCY 值复制到 COleCurrency 对象,并且其状态设置为有效。

  • operator =( curSrc ) 该操作数的值和状态,现有 COleCurrency 对象复制到此 COleCurrency 对象。

  • operator =( varSrc ),如果 VARIANT 值(或 COleVariant 对象的)转换为货币(VT_CY)成功,该转换的值复制到此 COleCurrency 对象,并且其状态设置为有效。如果转换不成功,COleCurrency 对象的值设置为0及其为无效的状态。

有关更多信息,请参见 Windows SDK的 货币变量 项。

示例

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

// operator= copies COleCurrency types
cur2 = cur1;
ASSERT(cur1 == cur2);

// can be used to assign a CURRENCY type, as well
CURRENCY cy;
cy.Hi = 0;
cy.Lo = 350050;
cy.int64 = 350050;

// perform assignment
COleCurrency cur3;
cur3 = cy;
ASSERT(cur3 == cur1);

要求

Header: afxdisp.h

请参见

参考

COleCurrency选件类

层次结构图

COleCurrency::COleCurrency

COleCurrency::SetCurrency

COleCurrency::GetStatus