title: Forward declaring an enum in C++
body: <p>I'm trying to do something like the following:</p>
  
  <pre><code>enum E;
  
  void Foo(E e);
  
  enum E {A, B, C};
  </code></pre>
  
  <p>which the compiler rejects.  I've had a quick look on Google and the consensus seems to be "you can't do it", but I can't understand why.  Can anyone explain?</p>
  
  <p>Clarification 2: I'm doing this as I have private methods in a class that take said enum, and I do not want the enum's values exposed - so, for example, I do not want anyone to know that E is defined as</p>
  
  <pre><code>enum E {
      FUNCTIONALITY_NORMAL, FUNCTIONALITY_RESTRICTED, FUNCTIONALITY_FOR_PROJECT_X
  }
  </code></pre>
  
  <p>as project X is not something I want my users to know about.</p>
  
  <p>So, I wanted to forward declare the enum so I could put the private methods in the header file, declare the enum internally in the cpp, and distribute the built library file and header to people.</p>
  
  <p>As for the compiler - it's GCC.</p>