共用方式為


COleCurrency::operator =

These overloaded assignment operators copy the source currency value into this COleCurrency object.

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

Remarks

A brief description of each operator follows:

  • operator =( cySrc )   The CURRENCY value is copied into the COleCurrency object and its status is set to valid.

  • operator =( curSrc )   The value and status of the operand, an existing COleCurrency object are copied into this COleCurrency object.

  • operator =( varSrc )   If the conversion of the VARIANT value (or COleVariant object) to a currency (VT_CY) is successful, the converted value is copied into this COleCurrency object and its status is set to valid. If the conversion is not successful, the value of the COleCurrency object is set to 0 and its status to invalid.

For more information, see the CURRENCY and VARIANT entries in the Windows SDK.

Example

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

Requirements

Header: afxdisp.h

See Also

Reference

COleCurrency Class

Hierarchy Chart

COleCurrency::COleCurrency

COleCurrency::SetCurrency

COleCurrency::GetStatus