When we have,
struct E { enum E_ { HELLO }; }; // 'E' is inheritable
then why do we need,
enum class E { HELLO }; // 'E' is not inheritable
IMO 2nd version doesn't offer more features than the 1st. I don't think that enum class
is introduced just to save 2 curly braces {};
! Am I missing any important aspect ?
As a minor question, is there any difference between enum class
and enum struct
other than syntax (because both have public
access specifier) ?