Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9265255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:01:27+00:00 2026-06-18T14:01:27+00:00

Is the type enum class a completely separate from a traditional class, or is

  • 0

Is the type enum class a completely separate from a traditional class, or is its implementation similar? How does enum class work? The reason I ask is because I don’t understand how it can be similar to both a class and an enum at the same time. I assume an enum class cannot have a constructor, or internal methods?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T14:01:28+00:00Added an answer on June 18, 2026 at 2:01 pm

    It’s related to an ordinary enum in that it consists of a set of names for constant values. It’s related to a class in that the names are all contained within the scope of the type’s name. So:

    enum my_enum {
        first,
        second,
        third
    };
    
    my_enum value = second; // OK; enumeration names are in global scope here
    
    enum class my_class_enum {
        fourth,
        fifth,
        sixth
    };
    
    my_class_enum other_value = fourth; // Error
    my_class_enum another_value = my_class_enum::fourth; // OK
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A using declaration does not seem to work with an enum type: class Sample{
Currently, I am using a type-safe enum class from Boost Vault : Which Typesafe
Emacs cc-mode does not appear to yet recognize the type-safe enum class introduced in
GenoTipController must produce class according to the enum type. i have 3 class: _Company,_Muayene,_Radyoloji.
Is the enum type signed or unsigned? Does the signedness of enums differ between:
I have one class that declares an enumeration type as: public enum HOME_LOAN_TERMS {FIFTEEN_YEAR,
I have a enum type: enum class MyEnumType { A , B , C
I am trying to make an enum-type class in Python but it gets so
Possible Duplicate: Adding enum type to a list I have an enum class: public
Why does javac add values() and valueOf(String) methods to the enum type being defined?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.