Given the following code, which of the following will compile?
enum Food { RICE, NOODLE, CORIANDER, ROSEMARY; }
Object()
; Food sp = object; Object()
; Food sp = (Food)object; A, B, D.
Enum values may be converted to Object, just like other objects.
So A and B are legal, though the cast in B is not necessary.
Assigning an Object reference to an enum requires a cast, so C is illegal, but D is legal.