[fpc-pascal] abstract classes

Howard Page-Clark hdpc at talktalk.net
Mon Jan 21 00:37:57 CET 2013


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.



More information about the fpc-pascal mailing list