hi all,
After reading this excerpt from "The C# Programming Language", (By
Anders) I tried to check it out. Unfortunately, I'm getting compile
errors.
Can anyone illustrate this with an example:
----------------------------------------------------
Section 7.7.4 - enumeration addition
----------------------------------------------------
Every enumeration type implicitly provides the following predefined
operators, where E is the enum type and U is the underlying type of E.
E operator +(E x, U y);
E operator +(U x, E y);
The operators are evaluated exactly as (E)((U)x + (U)y).
Section 7.7.5 - enumeration subtraction
-----------------------------------------------------------
Every enumeration type implicitly provides the following predefined
operator, where E is the enum type and U is the underlying type of E.
U operator -(E x, E y);
This operator is evaluated exactly as (U)((U)x - (U)y). In other
words, the operator computes the difference between the ordinal values
of x and y, and the type of the result is the underlying type of the
enumeration.
E operator -(E x, U y);
This operator is evaluated exactly as (E)((U)x - y). In other words,
the operator subtracts a value from the underlying type of the
enumeration, yielding a value of the enumeration.
-----------------------------------------------------------
Thanks in advance