How does the Number Class compare with Currency data types?
Microsoft provides a data type called “CURRENCY” as part of its OLE (Object Linking & Embedding) technology. To use it in a C++ application, you need to use MFC, which provides a C++ class called COleCurrency. (In Visual Basic this number type is called VB Currency.) COleCurrency behaves like a 64-bit integer with automatic scaling to support 4 digits to the right of the decimal point. While this is a little more convenient than resorting to manual scaling of C++’s basic integer data type, it still suffers from a number of drawbacks: • it doesn’t allow more than 4 digits to the right of the decimal point • you can perform addition and subtraction, but no other arithmetic operations between 2 COleCurrency values • multiplication or division can only be done against perfect integers, not floating point or another COleCurrency • use of COleCurrency requires MFC, adding needless overhead and Windows-dependency The Base/1 Number Class has none of these limitations. It can be used just like