title: Please explain the sequence of execution in the following code
body: <ol>
  <li><p>I am trying to solve a quiz and came across this question.<br>
  Please explain what happens internally that leads to this Output</p>
  
  <pre><code>class B;
  
  class A { 
      friend class B;
  
      public: 
      ~A() {
          B boj();
          cout &lt;&lt; "object A destructor " &lt;&lt; endl;
      } 
  }; 
  
  class B  { 
      public: 
      ~B() { cout &lt;&lt; "object B destructor " &lt;&lt; endl; } 
  }; 
  
  int main() { 
      A a;
      A aobj(); 
      B bobj();
  }
  </code></pre>
  
  <p>The output is:</p>
  
  <blockquote>
    <p>Object A destructor</p>
  </blockquote></li>
  <li><p>I am trying to create a program where a user enters if he wishes to add another record, and if yes then create a new object for that record.</p>
  
  <p>So if I am including constructors, then how do I create a new object every time the user wants?</p>
  
  <p>(If I give a predefined size to the array of object, then constructor will be called, say 50 times and initialize all 50 objects, while the user may only want to enter less).</p></li>
  </ol>