title: Initializing a base class that has the same name as a member variable
body: <p>Given that I have:</p>
  
  <ul>
  <li>a base class called <code>A</code></li>
  <li>a constructor for <code>A</code> that takes an <code>int</code> argument</li>
  <li>a subclass called <code>B</code> that inherits from <code>A</code></li>
  <li>a member variable of class <code>B</code> that is an <code>int</code> and is called <code>A</code></li>
  </ul>
  
  <p>How do I call the constructor <code>A::A(int)</code> in <code>B</code>'s constructor? It seems that all I can do is initialize the member variable called <code>A</code>. </p>
  
  <p>Her's a short code reproducing the issue:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  class A
  {
  public:
      A();
      A(int);
  };
  
  class B : public A 
  {
  public:
      B();
      int A = 100;
  };
  
  A::A()
  {
      std::cout &lt;&lt; "in constructor A";
  }
  
  A::A(int s)
  {
      std::cout &lt;&lt; "value in A constructor " &lt;&lt; s;
  }
  
  // Here I want to initialize the base class with 50
  // and the member with 78. Is it possible?
  
  B::B() : A(50), A(78) 
  {
      std::cout &lt;&lt; "in Constructor B";
      std::cout &lt;&lt; A;
  }
  
  int main()
  {
      B b;
  }
  </code></pre>
  
  <p>I want to initialize class member A with 78, and call the base class constructor with 50. How can I do that?</p>
  
  <p>If I try to assign to the member instead:</p>
  
  <pre><code>B::B() : A(50)
  {
      A = 78;
      std::cout &lt;&lt; "in Constructor B";
      std::cout &lt;&lt; A;
  }
  </code></pre>
  
  <p>the output is</p>
  
  <pre class="lang-none prettyprint-override"><code>in constructor Ain Constructor B78
  </code></pre>
  
  <p>It's not calling the <code>A::A(int)</code> overloaded constructor.</p>