Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is that output that I see:</p> <p><code>one one made</code><br> <code>one one made</code><br> <code>one two made</code><br> <code>one one made</code><br> <code>one one made</code><br> <code>made one one</code><br> <code>made one one</code><br> <code>made one two</code><br> <code>5/6=0</code><br> <code>5/6=0</code><br> <code>4/2=2</code><br> <code>8/3=2</code><br> <code>made one one</code><br> <code>one one made</code><br> <code>5/10=0</code><br> <code>5/6=0</code><br></p> <p>And it make perfect sense to me. I don't see the default constructor of one being called 3 times for the first object.<br></p> <p>As far as the output goes, here what happens:</p> <p><code>two t1, t2(4, 2, 8, 3);</code></p> <p>For t1, it calls default constructor of one, for both the objects that are defined in class </p> <p><code>two (one x and one y)</code></p> <p>so output is "one one made" and "one one made" next it executes the default constructor of two so the output is "one two made" next for t2, it again calls default constructor of one for both x and y so the output is "one one made" and "one one made" next it executes </p> <p><code>x = one(a,b) and y =one(c,d)</code></p> <p>so now it prints "made one one" and "made one one" now in the constructor of two() as we have "made one two" the same gets printed...</p> <pre><code>cout &lt;&lt; t1 &lt;&lt; t2; one t3(5, 10), t4; </code></pre> <p>For this statement again, for t3, it calls the constructor of one and prints "made one one" And for t4 it executes the default constructor and prints "one one made"</p> <pre><code>cout &lt;&lt; t3 &lt;&lt; t4; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload