title: Enum covarience for virtual function return
body: <p>Why does C++ not recognise <code>enum MyEnum : int</code> as being co-variant to <code>int</code>?</p>
  
  <p>Example: <a href="http://ideone.com/Ns1O2d" rel="nofollow">http://ideone.com/Ns1O2d</a></p>
  
  <pre><code>#include &lt;iostream&gt;
  
  enum FooType : int
  {
      Crazy = 0,
      Cool
  };
  
  enum BarType : int
  {
          Hello = Cool + 1,
          World
  };
  
  class Foo
  {
  public:
          Foo(void)
          {
          }
  
          ~Foo(void)
          {
          }
  
          virtual int getType(void) 
          {
                          return Crazy;
          }
  };
  
  class Bar : public Foo
  {
  public:
          Bar(void)
          {
          }
  
          ~Bar(void)
          {
          }
  
          virtual BarType getType(void)
          {
                  return Hello;
          }
  };
  
  int main(int argc, char* argv[])
  {
          Bar f = Bar();           
          std::cout &lt;&lt; f.getType() &lt;&lt; std::endl;
          return 0;
  }
  </code></pre>
  
  <p>Compilation error:</p>
  
  <pre><code>prog.cpp:43:18: error: conflicting return type specified for 'virtual BarType Bar::getType()'
  prog.cpp:26:14: error:   overriding 'virtual int Foo::getType()'
  </code></pre>