shadow:standard

Interface CanAdd<T>

interface CanAdd<T>

Interface CanAdd<T> specifies that a class can be added to an object of type T, producing a T. This interface allows overloading of the + operator. If the + operator is applied, the appropriate add(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) add(T other)

Method called when the + operator is overloaded.

Method Detail

add

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

Method called when the + operator is overloaded.

Parameters

other - other object to be added

Returns

result of the add