Quote Originally Posted by arthurprs
Code:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TPoint2d = record
   x,y: integer;
   class operator Add(v1,v2: TPoint2d): TPoint2d;
  end;

  TForm1 = class(TForm)
  private
  public
    { Public declarations }
  end;

var
  Form1: TForm1;


implementation


{$R *.dfm}

class operator Tpoint2d.add(v1, v2: Tpoint2d): Tpoint2d;
begin
  Result.x := v1.x  + v2.x;
  Result.y := v1.y + v2.y;
end;

end.
This don't compile ;/
This should compile

If you are interested in OO(the delphi way) I have written a little article(in danish) with small bits of code here:

http://udvikleren.dk/Delphi/Article.aspx/297/