enum

I want to define enumeration inside a structure and use it in some other file

for eg

1
2
3
4
5
6
7
8
9
10
11
12
header.h
typedef struct dummy {
  typedef enum {
       ZERO,
       ONE,
       MAX
  } NUMBERS;

  // some member variables
 } DUMMY; // end of the structure

otherfile.cpp


in this file i want to access both enumerations(for eg) ONE as well as the type
NUMBERS. Please let me know if you ahve any suggestion.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// header

struct dummy {

    enum numbers {

       ZERO,
       ONE,
       MAX
    };

  // some member variables

 }; // end of the structure 



1
2
3
4
5
// otherfile.cpp

// include header

dummy::numbers the_number = dummy::ONE ;

Topic archived. No new replies allowed.