title: How is my method call resolved?
body: <p>Please <strong>definitively explain what the method resolution rules are</strong> in the following case. I have an idea, based on the behavior of the code, but would like clarification.</p>
  
  <p>Based on "The const-ness of the calling object determines which version of MyArray::Get() will be invoked and thus whether or not the caller is given a reference with which he can manipulate or only observe the private data in the object. The two methods technically have different signatures because their "this" pointers have different types, allowing the compiler to choose the right one" from <a href="http://en.wikipedia.org/wiki/Const-correctness" rel="nofollow">wikipedia const correctness</a>, I would conclude that my example should be a case of <strong>method overloading, <em>not</em> method overriding</strong> (since a const method and a non-const method have two different signatures).</p>
  
  <pre><code>class Base
  {
  public:
  
      void test()
      { std::cout &lt;&lt; "nonconst call" &lt;&lt; std::endl; }
  };
  
  class Child : public Base
  {
  public:
  
      void test() const
      {
          std::cout &lt;&lt; "const call" &lt;&lt; std::endl;
          Child * nonConstThis = const_cast&lt;Child * &gt;(this);
          Base * nonConstBase = dynamic_cast&lt;Base * &gt;(nonConstThis);
  
          // This call leads to infinite recursion by calling
          // "void Child::test() const", which implies that
          // a "Child *" will resolve to calling a const Child function
          // before calling a non-const Base function.
          //nonConstThis-&gt;test();
  
          // This will call "void Base::test()"
          nonConstBase-&gt;test();
      }
  
  };
  
  void main()
  {
      Child * child = new Child;
      child-&gt;test();
  }
  </code></pre>