title: warning on derived class member shadowing base class member
body: <p>C++ compilers warn when a local variable shadows another variable.
  e.g. <a href="https://godbolt.org/g/TYYf8F" rel="noreferrer">https://godbolt.org/g/TYYf8F</a></p>
  
  <p>However none of the major C++ compilers warn when a member of a derived class shadows a member of the base class:</p>
  
  <pre><code>class A
  {
      int _memberVar = 2;
  
    public:
      virtual int memberVar()
      {
          return _memberVar;
      }
  };
  
  class B : public A
  {
      int _memberVar = 3;
  };
  
  int main()
  {
      A* pB = new B();
      return pB-&gt;memberVar(); // returns 2
  }
  </code></pre>
  
  <p>see <a href="https://godbolt.org/g/fBMUAd" rel="noreferrer">https://godbolt.org/g/fBMUAd</a></p>
  
  <p>Is there a reason behind it?</p>