[fpc-pascal] abstract classes
Leonardo M. Ramé
martinrame at yahoo.com
Mon Jan 21 23:28:28 CET 2013
>________________________________
> From: Howard Page-Clark <hdpc at talktalk.net>
>To: FPC users list <fpc-pascal at lists.freepascal.org>
>Sent: Sunday, January 20, 2013 8:37 PM
>Subject: [fpc-pascal] abstract classes
>
>FPC allows the Delphi-compatible "class abstract" syntax, but does not seem to prevent instantiation of such a class.
>The following code compiles and runs satisfactorily (FPC version 2.6.0)
>Does trunk prevent this compiling?
>
>program Project1;
>
>{$mode objfpc}{$H+}
>
>type
> TAbstractClass = class abstract
> class function GetID: integer; static;
> end;
>
>class function TAbstractClass.GetID: integer;
>begin
> Result:= 10;
>end;
>
>var
> ac: TAbstractClass;
>
>begin
> ac:= TAbstractClass.Create;
> WriteLn(ac.GetID);
> ReadLn;
> ac.Free;
>end.
>
As far as I remember Delphi has the same behavior.
Leonardo M. Ramé
http://leonardorame.blogspot.com
More information about the fpc-pascal
mailing list