Possible Duplicate:
Is there a reason to use enum to define a single constant in C++ code?
I just came across the following snippet in some old code, with an odd use of enum:-
class MyClass
{
public:
  enum {MAX_ITEMS=16};
  int things[MAX_ITEMS];
...
} ;
This is better than #define MAX_ITEMS 16 but is it any different from static const int MAX_ITEMS=16;?
Digging back into the mists of memory, I remember some C++ compilers not allowing you to initialize consts within the class, instead requiring a separate...
const int MyClass::MAX_ITEMS = 16; 
... in the .cpp source file. Is this just an old workaround for that?
 
     
    