I'm creating a model for Math Problems. This contains always two properties, and has a CorrectResult method which returns the addition of the two numbers. The propeties data types can be decimal, int, double, or a Fraction.Here's the UML for fraction:
A fraction contains a numerator and denominator, has a property called decimal where returs (double)Numerator / Denominator
. And also I put some operators.
Here is the model for the binary problem.
First, I was thinking in create this class into a generic class. But later I realized that for flexibility later, I will need this situations, I mean Mixed datatypes.
I guess I can create interfaces which contains information about the datatypes and the correct method. I'm not sure, I'm a bit lost in this situation.
Can you orient me how can I fix this scenario?