C++ Class returning old values?
<p>I can't seem to figure out why this code,</p>

<pre><code>class test{
    public:
    int number;
    test(int pass){
      number = pass;
    }
};

int main(){
   test x(3);
   test y(2);
   test z[2]={x,y};
   y.number = 1;
   cout &lt;&lt; "z[0].number: " &lt;&lt; z[0].number &lt;&lt; endl;
   cout &lt;&lt; "z[1].number: " &lt;&lt; z[1].number &lt;&lt; endl;
   cout &lt;&lt; "x.number: " &lt;&lt; x.number &lt;&lt; endl;
   cout &lt;&lt; "y.number: " &lt;&lt; y.number &lt;&lt; endl;
   return 0;
}
</code></pre>

<p>Comes up with this output,</p>

<pre><code>z[0].number: 3
z[1].number: 2
x.number: 3
y.number: 1
</code></pre>

<p>Instead of this one,</p>

<pre><code>z[0].number: 3
z[1].number: 1
x.number: 3
y.number: 1
</code></pre>

<p>How can I make the second output possible? I've searched for this for three days, and still no luck :(</p>
