Search code examples
c++classenumsusing

is it possible to nest to class existing enum


I have enum in some header file. Is it possible to nest to the class existing enum?

Explanation:

some headerfile.h:

enum someEnum
{
someValue
/*other values*/
};

other header:

#include "headerfile.h"
class someClass
{
 public:
  //using enum someEnum; //don't work as I want
 };

I want that someValue will be accesible as

     someClass::someValue 

So my question is it possible?


Solution

  • well one way would be to do this:

    class someClass
    {
     public:
    
    #include "headerfile.h"
    
      //using enum someEnum; //don't work as I want
    
     };
    

    not pretty but works.