mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
Merge pull request #416 from tituswinters/enum.3
Identifiers in enum class can overlap.
This commit is contained in:
commit
941661a495
|
@ -6252,7 +6252,7 @@ Instead use an `enum class`:
|
||||||
void PrintColor(int color);
|
void PrintColor(int color);
|
||||||
|
|
||||||
enum class Webcolor { red=0xFF0000, green=0x00FF00, blue=0x0000FF };
|
enum class Webcolor { red=0xFF0000, green=0x00FF00, blue=0x0000FF };
|
||||||
enum class Productinfo { Red=0, Purple=1, Blue=2 };
|
enum class Productinfo { red=0, purple=1, blue=2 };
|
||||||
|
|
||||||
Webcolor webby = Webcolor::blue;
|
Webcolor webby = Webcolor::blue;
|
||||||
PrintColor(webby); // Error: cannot convert Webcolor to int.
|
PrintColor(webby); // Error: cannot convert Webcolor to int.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user