Auszug aus der C++-Doku:
The underlying type of an enumeration is an integral type that can
represent all the enumerator values defined in the enumeration.
If no integral type can represent all the enumerator values, the
enumeration is ill-formed. It is implementationdefined
which integral type is used as the underlying type for an enumeration
except that the underlying type shall not
be larger than int unless the value of an enumerator cannot fit in an
int or unsigned int. If the enumerator-list
is empty, the underlying type is as if the enumeration had a single
enumerator with value 0. The value of sizeof()
applied to an enumeration type, an object of enumeration type, or an
enumerator, is the value of sizeof() applied to
the underlying type.
Es ist also nicht klar, welcher Datentyp hinter Deinem enum liegt.
Zuweisungen von anderen Datentypen zu Enums sind eigentlich verboten.
Ich würde vorschlagen, die Tage als defines abzulegen
1 | #define NODAY 0
|
2 | #define MONTAG 1
|
3 | #define DIENSTAG 2
|
4 | ...
|
und dann eWochentag als entspr. integralen Datentyp (z.B. int oder char)
zu definieren.