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

  • SEARCH
  • Home
  • 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 8582145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:13:18+00:00 2026-06-11T21:13:18+00:00

I am a beginner in C++ programming. Today I come across a new topic:

  • 0

I am a beginner in C++ programming.

Today I come across a new topic: strongly typed enum. I’ve researched it a bit but till now I am unable to find out why do we need this and what is the use of the same?

For example if we have:

enum xyz{a, b, c};
/*a = 0, b = 1, c = 2, (Typical C format)*/

Why do we need to write:

enum class xyz{a, b, c};

What are we trying to do here?
My most important doubt is how to use it.
Could you provide a small example, which will make me understand.

  • 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-11T21:13:19+00:00Added an answer on June 11, 2026 at 9:13 pm

    OK, first example: old-style enums do not have their own scope:

    enum Animals {Bear, Cat, Chicken};
    enum Birds {Eagle, Duck, Chicken}; // error! Chicken has already been declared!
    
    enum class Fruits { Apple, Pear, Orange };
    enum class Colours { Blue, White, Orange }; // no problem!
    

    Second, they implicitly convert to integral types, which can lead to strange behaviour:

    bool b = Bear && Duck; // what?
    

    Finally, you can specify the underlying integral type of C++11 enums:

    enum class Foo : char { A, B, C};
    

    Previously, the underlying type was not specified, which could cause compatibility problems between platforms. Edit It has been pointed out in comments that you can also specify the underlying integral type of an “old style” enum in C++11.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm very much still a beginner at programming but I have come across the
I am beginner for programming.I referred books of C programming,but i am confused. 1.)
Pretty new to C# (and I would describe myself as a beginner in programming,
This might be an overly simple question, but I am a beginner at programming
hey i am a beginner in programming.so it may sound stupid. but i really
hello i'm beginner for programming I've got a homework. googled it but couldnt find
I'm a beginner in programming and I'm having a bit of trouble with the
I am a beginner programming android. I am searching for info how to create
As a beginner in programming it always bugs me when I run into a
I'm a beginner in programming. I've just made a program called Guessing Game. And

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.