C++ Language/Type/Enumeration

From Wikibooks, open books for an open world
Jump to navigation Jump to search

A traditional enumeration was written as enum ERType {ZERO=0, ONE, TWO};, but modern code writes it as enum class ERType {...};. In the modern way, values must be fully-qualified as ERType::TWO when they are used.

Additional information about enumeration (includes interactive examples)