Overloaded operators

From Rosetta Code
Revision as of 15:52, 13 September 2021 by Puppydrum64 (talk | contribs) (Created page with " An https://en.wikipedia.org/wiki/Operator_overloading overloaded operator can be used on more than one data type, or represents a different action depending on the contex...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

An [overloaded operator] can be used on more than one data type, or represents a different action depending on the context. For example, if your language lets you use "+" for adding numbers and concatenating strings, then one would say that the "+" operator is overloaded.

Task

Demonstrate overloaded operators in your language, by showing the different types of data they can or cannot operate on, and the results of each operation.