tag:blogger.com,1999:blog-14389137.post6165719376059803857..comments2023-05-26T17:02:08.410+05:30Comments on Learning C++: Extending enumsabnegatorhttp://www.blogger.com/profile/09139822935584399971noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-14389137.post-26343557006600579132012-04-20T21:04:41.909+05:302012-04-20T21:04:41.909+05:30This is a useful trick, but it doesn't really ...This is a useful trick, but it doesn't really extend the enum enum_a::constant. It creates a new enum called enum_b::constant that won't conflict with enum_a::constant. But as far as the compiler is concerned, they are two unrelated constants. If you have a compiler that checks your usage of enums (e.g., gcc with -Wall), you won't be able to mix the constants. For example, it will complain about the following code:<br />enum_b::constant example = enum_a::c;Tom Panninghttps://www.blogger.com/profile/03246173249356394513noreply@blogger.com