title: Assignment of objects in C++
body: <p>To contextualize my question, I'm using a Matrix class with the following definitions:</p>
  
  <pre><code>Matrix(unsigned int, unsigned int); // matrix of the given dimension full of zeroes
  Matrix(Matrix*); // creates a new matrix from another one
  int &amp;operator()(int, int);  // used to access the matrix
  int **matrix; // the matrix
  </code></pre>
  
  <p>Now take these two code snippets:</p>
  
  <p>First:</p>
  
  <pre><code>Matrix test(4,4);
  Matrix ptr = test;
  ptr(0,0) = 95;
  </code></pre>
  
  <p>Second:</p>
  
  <pre><code>Matrix test(4,4);
  Matrix *ptr = &amp;test;
  (*ptr)(0,0) = 95;
  </code></pre>
  
  <p>Both codes have the same effect, the element in the (0,0) position receives 95 (The first snippet is very similar to Java, the reason which led me to ask this question).
  The question is, are both ways correctly making the assignment of the object?</p>