title: Calling a class's constructor inside another class
body: <p>I have a test next week for c++ and I'm preparing myself for it. I'm confused when I have 2 classes as shown below. I have to walk through the execution of the code, line by line, and I'm confused about the marked lines (<code>x = ...</code> and <code>y = ...</code> inside <code>class two</code>) - where does execution go from there?</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  class one {
      int n;
      int m;
      public:
      one() { n = 5; m = 6; cout &lt;&lt; "one one made\n"; }
      one(int a, int b) {
          n = a;
          m = b;
          cout &lt;&lt; "made one one\n";
      }
      friend ostream &amp;operator&lt;&lt;(ostream &amp;, one);
  };
  
  ostream &amp;operator&lt;&lt;(ostream &amp;os, one a) {
      return os &lt;&lt; a.n &lt;&lt; '/' &lt;&lt; a.m &lt;&lt; '=' &lt;&lt;
          (a.n/a.m) &lt;&lt; '\n';
  }
  
  class two {
      one x;
      one y;
      public:
      two() { cout &lt;&lt; "one two made\n"; }
      two(int a, int b, int c, int d) {
          x = one(a, b);  //here is my problem
          y = one(c, d);  //here is my problem
          cout &lt;&lt; "made one two\n";
      }
      friend ostream &amp;operator&lt;&lt;(ostream &amp;, two);
  };
  
  ostream &amp;operator&lt;&lt;(ostream &amp;os, two a) {
      return os &lt;&lt; a.x &lt;&lt; a.y;
  }
  
  int main() {
      two t1, t2(4, 2, 8, 3);
      cout &lt;&lt; t1 &lt;&lt; t2;
      one t3(5, 10), t4;
      cout &lt;&lt; t3 &lt;&lt; t4;
      return 0;
  }
  </code></pre>