title: error: passing 'const …' as 'this' argument of '…' discards qualifiers
body: <blockquote>
  <p>error: passing 'const A' as 'this' argument of 'void A::hi()' discards
  qualifiers [-fpermissive]</p>
  </blockquote>
  <p>I don't understand why I'm getting this error, I'm not returning anything just passing the reference of the object and that is it.</p>
  <pre><code>#include &lt;iostream&gt;
  
  class A
  {
  public:
      void hi()
      {
          std::cout &lt;&lt; &quot;hi.&quot; &lt;&lt; std::endl;
      }
  };
  
  class B
  {
  public:
      void receive(const A&amp; a) {
          a.hi();
      }
  };
  
  class C
  {
  public:
      void receive(const A&amp; a) {
          B b;
          b.receive(a);
      }
  };
  
  int main(int argc, char ** argv)
  {
      A a;
      C c;
      c.receive(a);
  
      return 0;
  }
  </code></pre>
  <p><strong>@edit</strong></p>
  <p>I fixed it using const correctness but now I'm trying to call methods inside of the same method and I get the same error, but the weird thing is that I'm not passing the reference to this method.</p>
  <pre><code>#include &lt;iostream&gt;
  
  class A
  {
  public:
      void sayhi() const
      {
          hello();
          world();
      }
  
      void hello()
      {
          std::cout &lt;&lt; &quot;world&quot; &lt;&lt; std::endl;
      }
  
      void world()
      {
          std::cout &lt;&lt; &quot;world&quot; &lt;&lt; std::endl;
      }
  };
  
  class B
  {
  public:
      void receive(const A&amp; a) {
          a.sayhi();
      }
  };
  
  class C
  {
  public:
      void receive(const A&amp; a) {
          B b;
          b.receive(a);
      }
  };
  
  int main(int argc, char ** argv)
  {
      A a;
      C c;
      c.receive(a);
  
      return 0;
  }
  </code></pre>
  <blockquote>
  <p>error: passing 'const A' as 'this' argument of 'void A::hello()'
  discards qualifiers [-fpermissive]</p>
  <p>error: passing 'const A' as 'this' argument of 'void A::world()'
  discards qualifiers [-fpermissive]</p>
  </blockquote>