08.02.13, 21:52, Gerhard Scholz wrote:

Maybe I didn't understand the syntax correctly: I didn't see how to get
the value inside the method?

By accessing Self

example:

type
   TLongIntHelper = type helper for LongInt
     class procedure ShowValue; static;
   end;

class procedure TLongIntHelper.Test;
begin
   Writeln('Value=',self);
end;

Replace your static class procedure with regular method:

procecure TLongIntHelper.Test;
begin
  WriteLn(Self);
end;

Class static method is only needed if you are going to call it for the type declaration itself like: LongInt.PrintSize:

class procedure TLongIntHelper.PrintSize;
begin
  WriteLn(SizeOf(LongInt));
end;

static methods don't have a magic Self variable.

In any case I suggest to look for test which had been commited together with Sven patch.

Best regards,
Paul Ishenin
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to