title: C++ inheritance: scoping and visibility of members
body: <p>Can you explain why this is not allowed,</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  class B {
  private:
      int a;
  public:
      int a;
  };
  
  int main() {
      return 0;
  }
  </code></pre>
  
  <p>while this is?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  class A {
  public:
      int a;
  };
  
  class B : public A{
  private:
      int a;
  };
  
  int main() {
      return 0;
  }
  </code></pre>
  
  <p>In both the cases, we have one public and one private variable named <code>a</code> in <code>class B</code>.</p>
  
  <hr>
  
  <p>edited now!</p>