10.4 Considerations for (simple) type helpers

For simple types, the rules are pretty much the same as for records, plus there are some extra requirements:

The following gives an idea of the possibilities:

{$mode objfpc}
{$modeswitch typehelpers}

type
 TLongIntHelper = type helper for LongInt
   constructor create(AValue: LongInt);
   class procedure Test; static;
   procedure DoPrint;
 end;

constructor TLongIntHelper.create(AValue: LongInt);

begin
  Self:=Avalue;
  DoPrint;
end;

class procedure TLongIntHelper.Test;

begin
   Writeln('Test');
end;

procedure TLongIntHelper.DoPrint;

begin
   Writeln('Value :',Self);
end;

var
  i: LongInt;
begin
  I:=123;
  i.Test;
  $12345678.Test;
  LongInt.Test;
  I:=123;
  i.DoPrint;
  $12345678.DoPrint;
end.