共用方式為


COleCurrency Relational Operators

Compare two currency values and return nonzero if the condition is true; otherwise 0.

BOOL operator ==( 
   const COleCurrency& cur  
) const; 
BOOL operator !=( 
   const COleCurrency& cur  
) const; 
BOOL operator <( 
   const COleCurrency& cur  
) const; 
BOOL operator >( 
   const COleCurrency& cur  
) const; 
BOOL operator <=( 
   const COleCurrency& cur  
) const; 
BOOL operator >=( 
   const COleCurrency& cur  
) const;

Remarks

Note

The return value of the ordering operations (<, <=, >, >=) is undefined if the status of either operand is null or invalid. The equality operators (==, !=) consider the status of the operands.

Example

COleCurrency curOne(3, 5000);             // 3.5
COleCurrency curTwo(curOne);              // 3.5
BOOL b = (curOne == curTwo);              // TRUE

b = curOne < curTwo;                      // FALSE, same value
b = curOne > curTwo;                      // FALSE, same value
b = curOne <= curTwo;                     // TRUE, same value
b = curOne >= curTwo;                     // TRUE, same value
curTwo.SetStatus(COleCurrency::invalid);
b = curOne == curTwo;                     // FALSE, different status
b = curOne != curTwo;                     // TRUE, different status

Requirements

Header: afxdisp.h

See Also

Reference

COleCurrency Class

Hierarchy Chart

COleCurrency::GetStatus