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 6005297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:22:42+00:00 2026-05-23T01:22:42+00:00

class A { public: enum class { HELLO, WORLD }; }; Having known that,

  • 0
class A {
  public: enum class { HELLO, WORLD };
};

Having known that, inside a class, declaring a simple enum (rather than enum class) is a better idea, because it’s already typed with the class identification. But still above statement is a valid C++0x signature. Now how to access an unnamed enum class outside ?

int i = A::HELLO; // error: ‘HELLO’ is not a member of ‘A’
  • 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-05-23T01:22:43+00:00Added an answer on May 23, 2026 at 1:22 am

    Actually, that is not valid. The C++0x FDIS says (9.2p1)

    Except when used to declare friends (11.3) or to introduce the name of a member of a base class into a derived class (7.3.3), member-declarations declare members of the class, and each such member-declaration shall declare at least one member name of the class.

    In your case, no enumerator name is introduced into the class’ scope and no enumeration name is introduced either. So, no member name at all is introduced by that member-declaration.

    EDIT: And actually, there’s a more direct prohibition of the enumeration declaration. 7.2p2:

    The optional identifier shall not be omitted in the declaration of a scoped enumeration.

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

Sidebar

Related Questions

Let's assume we've got the following Java code: public class Maintainer { private Map<Enum,
I have a generic class public MyClass<TContext, T> where TContext : DataContext that effectively
I have the following class: public class ErrorMessage { public enum Severity { Error,
I have a question about the IEnumerator.GetEnumerator() method. public class NodeFull { public enum
I have the following class public class Car { public Name {get; set;} }
Assume the following class: public class MyEnum: IEnumerator { private List<SomeObject> _myList = new
I have the following class: public abstract class AbstractParent { static String method() {
This is my action class public Iterator<CgConsultant> getSearchresult() { List<CgConsultant> list =userSearch.getConsultantMatches(searchstring); System.out.println(The size
Given the following class public class Foo { public int FooId { get; set;
Suppose I have a class public class MyClass { private Set<String> set = new

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.