Tutorial by Topics: overloading

In C++, it is possible to define operators such as + and -> for user-defined types. For example, the <string> header defines a + operator to concatenate strings. This is done by defining an operator function using the operator keyword.

Most operators in Rust can be defined ("overloaded") for user-defined types. This can be achieved by implementing the respective trait in std::ops module.

Page 1 of 1