shadow:standard

Interface CanModulus<T>

interface CanModulus<T>

Interface CanModulus<T> specifies that a class can be divided by an object of type T, producing a remainder of T. This interface allows overloading of the % operator. If the % operator is applied, the appropriate modulus(T) method will be called. Although this interface allows the % operator to be overloaded with arbitrary functionality for any class, it is intended to make operations between numerical classes more readable.

Method Summary

Modifiers Return Types Method and Description
public readonly (T) modulus(T other)

Method called when the % operator is overloaded.

Method Detail

modulus

public readonly modulus(T other) => (T)

Method called when the % operator is overloaded.

Parameters

other - object to divide by

Returns

remainder of the division