Object-oriented modular arithmetic