title: return type of overloading assignment operator in c++
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3105798/why-must-the-copy-assignment-operator-return-a-reference-const-reference">Why must the copy assignment operator return a reference/const reference?</a><br>
    <a href="https://stackoverflow.com/questions/5463437/operator-overloading-in-c">Operator= overloading in C++</a>  </p>
  </blockquote>
  
  
  
  <p>I have already asked a question about this assignment operator overloading. I may be asking a foolish question. Pardon me.</p>
  
  <p>My class declaration is like this:</p>
  
  <pre><code>class Circle
  {
      public:
         Circle();
         Circle(const Circle &amp;);
         Circle(unsigned short rad);
         unsigned short getRadius() const { return itsradius; }
         void setRadius(unsigned short rad) { itsRadius = rad; }
      private:
         unsigned short itsRadius:
  };
  </code></pre>
  
  <p>My class definition:</p>
  
  <pre><code>Circle::Circle()
  {
     itsRadius = 0;
  }
  Circle::Circle(unsigned short rad)
  {
     itsRadius = rad;
  }
  Circle::Circle(const Circle &amp; rhs)
  {
     itsRadius = rhs.getRadius();
  }
  </code></pre>
  
  <p>I am overloading assignment operator like this:</p>
  
  <pre><code>SimpleCircle &amp; SimpleCircle::operator=(const SimpleCircle &amp; rhs)
  {
     itsRadius = rhs.getRadius();
     return *this;
  }
  </code></pre>
  
  <p>When we are working on the current object like "itsRadius = rhs.getRadius()", the current object's radius will be changed, then, what is the need for returning "*this" ? Can this function be re-written as a void one ? Is there any problem with it ? Or is it just a standard to follow ?</p>