Is the order of construction of member variables of a class undefined in c++?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/6308915/member-fields-order-of-construction">Member fields, order of construction</a>  </p>
</blockquote>



<p>If i have a class with two members like this:</p>

<pre><code>class A
{
    int a;
    int b;
    A() {}
};
</code></pre>

<p>Is the <em>order</em> in which <code>a</code> and <code>b</code> are constructed <em>undefined</em>?</p>

<p>If I use <code>cl</code>, then no matter in which order I call the constructors, the members are always constructed in the order in which they are declared in the class. In this case it would always be <code>a</code> then <code>b</code>, even if I define the constructor for <code>A</code> like:</p>

<pre><code>A() : b(), a() {}
</code></pre>

<p>But I am assuming that that is just the behaviour of the specific compiler.</p>
