62. Enum Classes

Question.6

A developer receives a byte from UART and casts it to an enum class:

enum class Command : uint8_t { READ=1, WRITE=2, RESET=3 };

uint8_t raw = uart_read();  // Could be any value 0-255
Command cmd = static_cast<Command>(raw);

If raw = 99, what happens?

Need Help? Refer to the Quick Guide below

Select Answer