
30 Nov
2006
30 Nov
'06
8:21 p.m.
Martin Bonner wrote:
In my opinion software design is not mathematical proof that one design is better than another, but there is the mathematical fact that the set of unsigned integers is a subset of the integers, and the set of modular integers is a subset of the integers.
But your classes do not represent the SET of integers and the SET of modular integers. They represent the FIELDS (you include the operators - and the class wouldn't be much use if they didn't.
The modular integers do NOT form a sub-field of the integers, which is why you shouldn't use derivation to represent them.
As mathematician who also writes C++ code, I would like to concur with both Martin's opinion and his rationale. I think he put it very well.