Op 2011-03-16 04:24, silvioprog het geskryf:

This is possible in Lazarus/FPC?:

type
   TFoo = record
     Value: string;
     function AsBoolean: Boolean;
   end;

function TFoo.AsBoolean: Boolean;
begin
   Result := StrToBoolDef(Value, False);
end;

In Delphi:

http://edn.embarcadero.com/article/34324

That is the stupidest feature I have seen in Delphi. They simply rehashed something that existed since pre-Delphi v1, and then call it something "new". What you are looking for is the age old Object structure.

    TFoo = object
      Value: string;
      function AsBoolean: Boolean;
    end;


And yes, FPC supports the Object structure. ;)


Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to