35 virtual bool is_one()
const override;
36 virtual bool is_zero()
const override;
72 auto o =
dynamic_cast<const Integer<T> &
>(other);
73 result.value = value + o.value;
80 auto o =
dynamic_cast<const Integer<T> &
>(other);
81 result.value = value - o.value;
88 auto & o =
dynamic_cast<const Integer<T> &
>(other);
89 result.value = value * o.value;
96 auto & o =
dynamic_cast<const Integer<T> &
>(other);
104 auto & o =
dynamic_cast<const Integer<T> &
>(other);
105 return value == o.value;
110 auto & o =
dynamic_cast<const Integer<T> &
>(other);
111 return value != o.value;
121 template <
typename T>
122 ostream & operator << (ostream & os, Integer<T> i) {
const Integer< T > & operator=(const Ring_Element &)
assignment operator may be needed
Definition: integer.hpp:94
T get_value() const
returns the value of this
Definition: integer.hpp:115
Integer()
initializes to zero
Definition: integer.hpp:52
elements of this type should be cancellable; there should be no zero divisors
Definition: rings.hpp:53
virtual Ring_Element & operator*(const Ring_Element &) const override
multiplicationL other element should be of same type, use a cast
Definition: integer.hpp:86
Definition: integer.hpp:6
encapsulates integers under the Ring_Element rubric
Definition: integer.hpp:17
virtual bool operator!=(const Ring_Element &) const override
comparison: other element has different value
Definition: integer.hpp:109
virtual bool is_one() const override
should be True iff element is multiplicative identity
Definition: integer.hpp:61
virtual bool has_inverse() const override
should be True iff element has a multiplicative inverse
Definition: integer.hpp:67
virtual bool is_zero() const override
should be True iff element is additive identity
Definition: integer.hpp:64
virtual bool operator==(const Ring_Element &) const override
comparison: other element has same value
Definition: integer.hpp:103
a class for elements with the capabilities of ring arithmetic
Definition: rings.hpp:9
virtual Ring_Element & operator-(const Ring_Element &) const override
subtraction: other element should be of same type, use a cast
Definition: integer.hpp:78
virtual Ring_Element & operator+(const Ring_Element &) const override
addition: other element should be of same type, use a cast
Definition: integer.hpp:70