<p>Am 11.05.2015 17:23 schrieb "Sven Barth" <<a href="mailto:pascaldragon@googlemail.com">pascaldragon@googlemail.com</a>>:<br>
><br>
> Am 11.05.2015 16:49 schrieb "misu kun" <<a href="mailto:misu.dev@gmail.com">misu.dev@gmail.com</a>>:<br>
> ><br>
> > thanks<br>
> > in objfpc mode i can imagine this ,but it didn't work unless i specialize (obj)<br>
> ><br>
> ><br>
> > type<br>
> > generic obj<T> = object<br>
> > x : T;<br>
> > end;<br>
> > operator + (arg1 ,arg2 : obj):obj; // error : here (obj) needs specialization<br>
> > begin<br>
> > result.x := arg1.x + arg2.x;<br>
> > end;<br>
><br>
> The method needs to be part of the object (you should use "record" though) like in the mode-Delphi-code, for this you need to add {$modeswitch advancedrecords} after the {$mode objfpc} directive.</p>
<p>And just to be clear: it needs to be "class operator +" inside of "obj".</p>
<p>Regards,<br>
Sven</p>