Hello FPC-Pascal, Friday, May 28, 2010, 6:57:42 PM, you wrote:
s> ======================== s> program __essai__; s> {$mode objfpc}{$H+} s> uses s> Classes, SysUtils; s> type Struct = Class s> val : Integer; s> constructor struct(i:Integer); s> function text : String; s> end; Apart the memory leaks wich are quite sure on purpose, you are using a loudspeaker calling for problems in the future: 1) Constructor with the same name as class name. If you write in code: procedure Struct.DoSomething; var n: Struct; begin n:=Struct(0); end; Which should the compiler do ? Create a new object n calling the Struct constructor using 0 as parameter, or cast zero to n ? 2) 2 constructors, one works the other simply does nothing. You can not "hide" the constructor "Create" as you are inheriting from TObject. 3) Variable name "val" (Use Value instead, there is a function called val). -- Best regards, José _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal