Code:
// CInc.h
//
#ifndef CINC_H_
#define CINC_H_
// Income levels
enum inct
{
BELOW_POVERTY,
POVERTY,
LOWER CLASS, // if I don't comment this line out to the last element
MIDDLE CLASS, // the program errors, error below in my post
UPPER CLASS,
RICH,
BILL_GATES
};
class CInc
{
private:
// Data about their income level, ya da ya da ya da
inct m_IncomeLevel;
public:
// Accessors
inct getInc() { return m_IncomeLevel; }
// Mutators
void setInc(inct IncomeLevel) { m_IncomeLevel = IncomeLevel; }
};
#endif CINC_H_
The error list is at the end of this post because it's rather long and I'm not sure which errors are relevant (I know it's usually the first ones or so, but in this case I'm not sure) Anyhow, it's confusing me. I have a 3 element enum in another header file that works fine, if I reduce this enum to 2 elements it's fine. I've checked the MSDN docs and it appears that this is the correct method of using an enum, so...any ideas?
Errors:
(12) : error C2146: syntax error : missing '}' before identifier 'CLASS'
(13) : error C2146: syntax error : missing ';' before identifier 'CLASS'
(13) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
(13) : error C2371: 'CLASS' : redefinition; different basic types
(12) : see declaration of 'CLASS'
(14) : error C2146: syntax error : missing ';' before identifier 'CLASS'
(14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
(14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
(14) : error C2371: 'CLASS' : redefinition; different basic types
(12) : see declaration of 'CLASS'
(15) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
(17) : error C2143: syntax error : missing ';' before '}'
(17) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
(17) : error C2143: syntax error : missing ';' before '}'
(17) : error C2059: syntax error : '}'