Defining Multiple Operators
Let’s discuss how to overload multiple operators simultaneously.
We'll cover the following
Use of multiple operators
To keep the code samples short, we have used only the ++
, +
, and +=
operators. It is conceivable that when one operator is overloaded for a type, many others would also need to be overloaded. For example, the --
and -=
operators are also defined for the following Duration
:
Get hands-on with 1400+ tech skills courses.