Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

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  

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.

// 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
cy.Hi = 0;
cy.Lo = 350050;
cy.int64 = 350050;

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

Header: afxdisp.h

© 2015 Microsoft