I have a simple state machine I am trying to implement. However, when I get a peculiar error:
State.cp:7:1: error: 'eState' does not name a type
eState CState::eGet(){
^
eState
is an enumerator from the class CState
:
#ifndef __STATE_H
#define __STATE_H
#include <string>
class CState {
public:
enum eState {
eData,
eInterface,
ePresentation,
eExit
};
And it is (Currently, non-functionally) returned like so:
private:
eState Current;
public:
estate eGet();
where eGet()
is defined like so:
eState CState::eGet(){
return Current;
};
I am trying to use .eGet()
as a switch value but my main function tells me the enum values aren't "declared in this scope"
Now obviously, I could just move the enumerator to a "Common.h"
file and have everybody #include
that, but it quite clearly belongs to the state class, so I'd prefer to keep it there.