title: no match for 'operator='
body: <p>I have built a static stack of structures, and everything works - including creating an array of the structures. However, for some reason I can't set the top of the array to a structure.</p>
  
  <p>In my <code>.cpp</code> file, in my <code>push</code> function, I keep erroring on the following line:</p>
  
  <pre><code>stackArray[top] = newStudent;
  </code></pre>
  
  <p>The error I am receiving is:</p>
  
  <blockquote>
    <p>"51: no match for 'operator=' in '<em>(((studentstack</em>)this)->studentstack::stackArray + (+(((unsigned int)((studentstack*)this)->studentstack::top) * 24u))) = ((studentstack*)this)->studentstack::newStudent' "</p>
  </blockquote>
  
  <p>I am including my code below.</p>
  
  <p>Header file:</p>
  
  <pre><code>#ifndef studentstack_H
  #define studentstack_H
  
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  class studentstack {
      private:
          int size;         // Stack size
          int top;          // Top of the Stack
  
          struct student {
              int ID;
              string Name;
              string Address;
              double GPA; 
          };
          student * stackArray;  // Pointer to the stack
          student * newStudent; // Pointer to the new student
  
      public: //Constructor
          studentstack(int);
  
          // Copy Constructor
          studentstack(const studentstack &amp;);
  
          //Destructor
          ~studentstack();
  
          //Stack Operaations
          void push(string, int, double, string);
          void pop(int &amp;);
          bool isFull() const;
          bool isEmpty() const;
      };
  
  #endif
  </code></pre>
  
  <p>studentstack.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "studentstack.h"
  
  using namespace std;
  
  studentstack::studentstack(int SIZE) {
      stackArray = new student[SIZE];
      size = SIZE;
      top = -1;
      int ID = 0;
      double GPA = 0;
  }
  
  studentstack::studentstack(const studentstack &amp;obj) {
      if (obj.size &gt; 0)
          stackArray = new student[obj.size];
      else
          stackArray = NULL;
  
      size = obj.size;
  
      for (int count = 0; count &lt; size; count++)
          stackArray[count] = obj.stackArray[count];
  
      top = obj.top;
  }
  
  studentstack::~studentstack() {
      delete [] stackArray;
  }
  
  void studentstack::push(string name, int id, double gpa, string address) {
      if (isFull()) {
          cout &lt;&lt; "The stack is full.\n";
      } else {
          top++;
          newStudent = new student;
          newStudent-&gt; Name = name;
          newStudent-&gt; ID = id;
          newStudent-&gt; Address = address;
          newStudent-&gt; GPA = gpa;
          stackArray[top] = newStudent;
      }
  }   
  
  void studentstack::pop(int &amp;id) {
      if (isEmpty()) {
          cout &lt;&lt; "The stack is empty.\n";
      } else {
          id = stackArray[top].ID;
          top--;
      }
  }
  
  bool studentstack::isFull() const {
      bool status;
  
      if (top == size - 1)
          status = true;
      else
          status = false;
  
      return status;
  }
  
  bool studentstack::isEmpty() const {
      bool status;
  
      if (top == -1)
          status = true;
      else
          status = false;
  
      return status;
  }
  </code></pre>
  
  <p>main.cpp</p>
  
  <pre><code>#include "studentstack.h"
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main() {
      string name;
      int id, var;
      string address;
      double gpa;
      studentstack s[20];
  
      for(int x =0; x&lt;20; x++) {
          cout &lt;&lt; "New Student Name: " &lt;&lt; endl;
          cin &gt;&gt; name;
  
          cout &lt;&lt; "ID: " &lt;&lt; endl;
          cin &gt;&gt; id;
  
          cout &lt;&lt; "GPA: " &lt;&lt; endl;
          cin &gt;&gt; gpa;
  
          cout &lt;&lt; "Address: " &lt;&lt; endl;
          cin &gt;&gt; address;
  
          s.push(name, id, gpa, address)
      }
  
      cout &lt;&lt; "Popping: "
      for(int x = 0; x &lt; 5; x++) {
          s.pop(var);
          cout &lt;&lt;var;
      }
  
      return(0);
  }
  </code></pre>