class Printer;
enum Printer::States;
class Printer { // choose one of monitor or cormonitor
States taskStates[];
public:
enum States { Starting = 'S', Blocked = 'B', Unblocked = 'U', Finished = 'F', // general
Napping = 'N', Awake = 'A', // Santa
Working = 'W', NeedHelp = 'H', // elf
OnVacation = 'V', CheckingIn = 'I', // reindeer
DeliveringToys = 'D', DoneDelivering = 'd', // Santa, reindeer
Consulting = 'C', DoneConsulting = 'c' // Santa, elves
};
Printer();
void print( unsigned int id, States state );
void print( unsigned int id, States state, unsigned int numBlocked );
};
class Printer; enum Printer::States; class Printer { // choose one of monitor or cormonitor
Share
You can’t declare nested enums outside of the class. You also have to have it be defined before you use it.
As a side-note, C++11’s
enum classonly has to be declared inside the class – it can be defined outside of it.