<?xml version="1.0" encoding="UTF-8"?>
<wiki>
  <body>&lt;h3&gt;Example&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;complex = number.subclass {
    function(self, real, imaginary)
        self.real = real
        self.imaginary = imaginary
    end;

    ['=='] = function(self, operand)
        return self.real == operand.real and self.imaginary == operand.imaginary
    end;

    ['+'] = function(self, operand)
        return complex(self.real + operand.real, self.imaginary + operand.imaginary)
    end;

    ['-'] = function(self, operand)
        return complex(self.real - operand.real, self.imaginary - operand.imaginary)
    end;

    -- and so on&#8230;
}
&lt;/code&gt;&lt;/pre&gt;</body>
  <created-at type="datetime">2008-08-07T22:18:10-07:00</created-at>
  <id type="integer">43537</id>
  <permalink>operatoroverloading</permalink>
  <repository-id type="integer">40949</repository-id>
  <title>OperatorOverloading</title>
  <updated-at type="datetime">2008-08-16T00:28:47-07:00</updated-at>
  <user-id type="integer">3823</user-id>
</wiki>
