title: Illegal member initialization in C++
body: <pre><code>class ZooAnimal {
  public:
      virtual void draw();
      int resolveType() {return myType;}
  protected:
      int myType;
  };
  
  class Bear : public ZooAnimal {
  public:
      Bear (const char *name) : myName(name), myType(1){}
      void draw(){ };
  private:
      std::string myName;
  };
  
  void main()
  {
     
  }
  </code></pre>
  <p>When I am compiling above code I am geeting following error</p>
  <blockquote>
  <p>error C2614: 'Bear' : illegal member initialization: 'myType' is not a base or member</p>
  </blockquote>
  <p>Why am I getting the above error, as we can access protected member from the derived class?</p>