title: C++ Array Type Not Assignable in Copy Constructor
body: <p>I have a simple class representing a triangle, which contains three arrays. </p>
  
  <pre><code>class Triangle
  {
  public:
    double         X[3];
    double         Y[3];
    unsigned char color[3];
  };
  </code></pre>
  
  <p>I want to create objects of this class on the heap, then pass them to a function that will use values from the arrays. Since I am passing in these objects, I need a copy constructor to make a deep copy. The problem arises when allocating the new arrays in the copy constructor.</p>
  
  <p>This is what I have thus far:</p>
  
  <pre><code>Triangle (const Triangle &amp;obj)
  {
      X = new double[3];
      Y = new double[3];
      color = new unsigned char[3];
      for (int i=0; i&lt;3; ++i)
      {
          X[i] = obj.X[i];
          Y[i] = obj.Y[i];
          color[i] = obj.color[i];
      }
  }
  </code></pre>
  
  <p>I keep getting the following error:
  "        error: array type 'double [3]' is not assignable" for each of the three arrays.</p>
  
  <p>I am taking the same approach as discussed in <a href="http://youtu.be/Palwk37qYC0?t=10m23s" rel="nofollow noreferrer">this video</a>, and I cannot figure out why I am unable to make a new array. The answer to <a href="https://stackoverflow.com/questions/22103771/copy-an-object-containing-an-array">this question</a> also has the same approach.</p>
  
  <p>Does anyone have any insights? I feel like I am just missing something really silly.</p>