Skip to main content

Practice ยท 2 of 2

enum class Priority weights

Define enum class Priority { Low, Normal, High, Critical } and implement int priority_weight(Priority) returning 0, 1, 5, 20 respectively. Use an exhaustive switch (no default case) so a future enumerator fails compilation.

Difficulty: intermediate

Back to lesson: Practice: optional and enum practice