title: Error Writing a Copy constructor in C++
body: <p>I am trying to write a copy constructor for a class but I get these two error messages, which I cannot decipher. Can somebody please tell me what I am doing incorrect?</p>
  
  <pre><code>class Critter
      {
  
      public:
          Critter(){}
          explicit Critter(int hungerLevelParam):hungerLevel(hungerLevelParam){}
          int GetHungerLevel(){return hungerLevel;}
  
          // Copy Constructors
          explicit Critter(const Critter&amp; rhs);
          const Critter&amp; operator=(const Critter&amp; rhs);
  
      private:
          int hungerLevel;
      };
  
  Critter::Critter(const Critter&amp; rhs)
      {
      *this = rhs;
      }
  
  const Critter&amp; Critter::operator=(const Critter&amp; rhs)
      {
      if(this != &amp;rhs)
          {
          this-&gt;hungerLevel = rhs.GetHungerLevel(); // ERROR: object has type qualifier not compatible with member function
          }
      return *this;
      }
  
  int _tmain(int argc, _TCHAR* argv[])
      {
      Critter aCritter2(10);
      Critter aCritter3 = aCritter2; // ERROR : No suitable copy constructor
      Critter aCritter4(aCritter3);
      return 0;
      }
  </code></pre>