Why is the copy constructor not called?
<pre><code>class MyClass
{
public:
  ~MyClass() {}
  MyClass():x(0), y(0){} //default constructor
  MyClass(int X, int Y):x(X), y(Y){} //user-defined constructor
  MyClass(const MyClass&amp; tempObj):x(tempObj.x), y(tempObj.y){} //copy constructor

private:
int x; int y;
};

int main()
{
 MyClass MyObj(MyClass(1, 2)); //User-defined constructor was called.
 MyClass MyObj2(MyObj); //Copy constructor was called.
}
</code></pre>

<p>In the first case, When <code>MyClass(1, 2)</code> calls the user-defined constructor and returns an object, I was expecting <code>MyObj</code> to call the copy constructor. why it doesn't need to call the copy constructor for the second instance of <code>MyClass</code>?</p>
