title: Overload operator to transpose array
body: <p>I'm tryining overload operator ~ that transpose a given matrix:</p>
  
  <p>Here's my code:</p>
  
  <pre><code>virtual B operator~()const
  {
      B a(column,row);
      for (int i = 0; i&lt;row; i++)
      {
          for (int j = 0; j&lt;column; j++)
          {
              a.e[i] = e[j];
          }
      }
      return a;
  }
  </code></pre>
  
  <p>e is pointer to the memory storing all integer elements of B</p>
  
  <pre><code>int *const e;
  </code></pre>
  
  <p>But on the output I've gotten a matrix filled by zeros and with the same size. I mean if I wnat transpose 5x2, I got the same 5x2 filled by zeros.</p>
  
  <p>Edit:
  My constuctor:</p>
  
  <pre><code>B(int r, int c)
      : row(r), column(c), e(new int[r*c])
  {
      for (int i = 0; i &lt; r*c; i++)
      {
          e[i] = 0;
      }
  }
  </code></pre>