Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

4.3 Same-Currency Calculations

RWMoney<T> provides global operators for performing same-currency arithmetic calculations in C++, and Money provides a similar set of arithmetic methods in Java. When objects created from these classes are used in arithmetic operations, all operands must be the same currency. If the currencies for operands in the same equation differ, the operator throws an exception (or, in Java, the method calls the error handler).

Similarly, all assignments to money objects must have the same currency as the original object. If not, an exception is thrown.

Here are some examples:

Example 1, C++:

Example 2, Java:


Previous fileTop of DocumentContentsIndexNext file

©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.