I'm working on a legacy project, in which the original developers have chosen to represent monetary values with floats (I know...)
We've taken on the task of switching every variable and property in the project that handles monetary values to NSDecimalNumber as suggested in the answer to this question.
One small issue we've run into is that NSDecimalNumbers do not use the standard arithmetic operators, and instead use methods. That is, when you use arithmetic operators, you're adding the memory addresses, and not the actual values. Overloading the arithmetic operators does not seem to be possible in Objective-C, although it would be with C++.
I'm thinking it's possible to create a category method on NSDecimalNumber, written in C++. I understand it's possible to add and compile C++ files as part of an Xcode iOS project, although I haven't done this and am not familiar with C++.
In looking for examples of how something like this would be done, I'm not finding a very much. Can anyone tell me:
1) Is it possible to do what I'm describing above?
2) What would the syntax be for this?