Can a C++ enum class have methods?

I have an enum class with two values, and I want to create a method which receives a value
and returns the other one. I also want to maintain type safety(that’s why I use enum class instead of enums).

http://www.cplusplus.com/doc/tutorial/other_data_types/ doesn’t mention anything about methods
However, I was under the impression that any type of class can have methods.

7 Answers
7

Leave a Comment