title: Assignment operator overload not getting called
body: <p>I have two classes, Database and Record.</p>
  
  <pre><code>class Database {
      private:
          Record* head;
      public:
          Database(Record*);
          Database();
          Database(const Database&amp;);
  
          Database&amp; operator= (const Database &amp;data);
  };
  
  class Record {
      public:
          Record(std::string, std::string, int, int, std::string);
          Record(const Record&amp;);
          Record();
  
          Record* next;
  };
  </code></pre>
  
  <p>Now when I do this</p>
  
  <pre><code>Database PM1, PM2;
  //operations on PM1
  PM2 = PM1;
  </code></pre>
  
  <p>All that happens is the values in PM1 are assigned to PM2. The assignment overload is never called. I have no idea as to why this may be happening. I've attempted to debug as well, but the function is just never entered. What am I doing wrong?</p>
  
  <p>EDIT: Here's the overload function, it may not be right, but I haven't been able to test it yet because I can't even get it to run.</p>
  
  <pre><code>Database&amp; Database::operator= (const Database &amp;data) {
      if(this == &amp;data)
          return *this;
      if(data.head == NULL) {
          this-&gt;head = NULL;
          return *this;
      }
      Record *curr1, *curr2;
      curr1 = new Record(*(data.head));
      this-&gt;head = curr1;
      for(curr2 = data.head-&gt;next; curr1 != NULL &amp;&amp; curr2 != NULL; curr1 = curr1-&gt;next) {
          curr1-&gt;next = new Record(*curr2);
          curr2 = curr2-&gt;next;
      }
      return *this;
  }
  </code></pre>