title: C++: Initialization of inherited field
body: <p>I've a question about initialization of inherited members in constructor of derived class. Example code:</p>
  
  <pre><code>class A
      {
  public:
      int m_int;
      };
  
  class B: public A
      {
  public:
      B():m_int(0){}
      };
  </code></pre>
  
  <p>This code gives me the following output: </p>
  
  <p><code>In constructor 'B::B()':
  Line 10: error: class 'B' does not have any field named 'm_int'</code></p>
  
  <p>(see <a href="http://codepad.org/tn1weFFP" rel="noreferrer">http://codepad.org/tn1weFFP</a>)</p>
  
  <p>I'm guessing why this happens? <code>m_int</code> should be member of <code>B</code>, and parent class <code>A</code> should already be initialized when initialization of <code>m_int</code> in <code>B</code> happens (because parent constructors run before member initialization of inherited class). Where is a mistake in my reasoning? What is really happens in this code?</p>
  
  <p><code>EDIT</code>: I'm aware of other possibilities to initialize this member (base constructor or assignment in derived constructor), but I want to understand why is it illegal in the way I try it? Some specific C++ language feature or such? Please point me to a paragraph in C++ standard if possible.</p>