title: C++ member functions with same name and parameters, different return type
body: <p>is it valid if I define member functions with same name&amp;parameters but different return types inside a class like this:</p>
  
  <pre><code>class Test {
  public:
      int a;
      double b;
  }
  
  class Foo {    
  private:
      Test t;
  public:
      inline Test &amp;getTest() {
          return t;
      }
      inline const Test &amp;getTest() const {
          return t;
      }
  }
  </code></pre>
  
  <p>Which member function gets called if we have following code?</p>
  
  <pre><code>Foo foo;  // suppose foo has been initialized
  Test&amp; t1 = foo.getTest();
  const Test&amp; t2 = foo.getTest();
  </code></pre>