C++ 23 · Language basics

Define a scoped enum

A strongly typed enum whose names don't leak into the surrounding scope.

enum class Color { Red, Green, Blue };
Color c = Color::Green;

Official C++ 23 documentation

More language basics commands

All language basics commands · C++ 23 cheatsheet

Was this page helpful?