title: += operator overloading in ruby
body: <pre><code>class Fracpri
  attr_accessor:whole, :numer, :denom, :dec, :flofrac
  def initialize()
      puts "Hey! It's an empty constructor"
  end
  def getFraction(whole,numer,denom)
      @whole=whole
      @numer=numer
      @denom=denom
  end
  def showFraction
      puts "#{whole} #{numer}/#{denom}"
  end
  def +=(obj)
      if(self.whole+(self.numer.to_f/self.denom.to_f) &lt; obj.whole+(obj.numer.to_f/obj.denom.to_f))
          puts "Yes"
      else
          puts "No"
      end
  end
  
  end
  puts "10 question"
  r3=Fracpri.new()
  r3.getFraction(1,2,3)
  r2=Fracpri.new()
  r2.getFraction(4,6,5)
  r1=Fracpri.new()
  r1.getFraction(2,6,5)
  r1 += r2
  </code></pre>
  
  <p>this is the error message I'm getting:</p>
  
  <pre><code>syntax error, unexpected '=', expecting ';' or '\n'
  
      def +=(obj)
            ^
  
   syntax error, unexpected keyword_end, expecting end-of-input
  </code></pre>
  
  <p>suggest me how to rectify this error so that i can perform overloading,i need to add a constant using "+=" operator</p>