Why do people use enums in C++ as constants while they can use const?

前端 未结 12 1451
梦毁少年i
梦毁少年i 2020-12-08 02:28

Why do people use enums in C++ as constants when they can use const?

12条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-08 03:04

    Some debuggers will show the enumeration name instead of its value when debugging. This can be very helpful. I know that I would rather see day_of_week = MONDAY than day_of_week = 1.

提交回复
热议问题