title: Why should the assignment operator return a reference to the object?
body: <p>I'm doing some revision of my C++, and I'm dealing with operator overloading at the minute, specifically the "="(assignment) operator. I was looking online and came across multiple topics discussing it. In my own notes, I have all my examples taken down as something like</p>
  
  <pre><code>class Foo
  {
      public:  
          int x;  
          int y;  
          void operator=(const Foo&amp;);  
  };  
  void Foo::operator=(const Foo &amp;rhs)
  {
      x = rhs.x;  
      y = rhs.y;  
  }
  </code></pre>
  
  <p>In all the references I found online, I noticed that the operator returns a reference to the source object.
  Why is the correct way to return a reference to the object as opposed to the nothing at all?</p>