title: Why child class variable initialize before parent class member variable
body: <p>Consider the code below. Fields <code>i</code> and <code>j</code> are initialized before <code>m</code> and <code>n</code>. We know that the parent object is created before the child object, but in my program the compiler is allocating and initializing memory for the child class' member variables before the base class'. Why is that?</p>
  
  <pre><code>class X
  {
      private int m = 0;
      private int n = 90;
      public X() { }
  }
  
  class Y:X
  {
      private int i = 8;
      private int j = 6;
      public Y()
      { }
      public static void Main(string []args)
      {
          Y y1 = new Y();  
      }
  }
  </code></pre>