[fpc-pascal] Use of abstract classes

Howard Page-Clark hdpc at talktalk.net
Tue Jan 8 13:06:45 CET 2013


On 08/1/13 11:48, Michael Fuchs wrote:
> program AbstractTest;
> {$MODE ObjFpc}{$H+}
>
> uses Classes;
>
> type
>    TAbstractClass = class abstract(TObject)
>    end;
>
> var
>    MyAbstractClass: TAbstractClass = nil;
>
> begin
>    MyAbstractClass := TAbstractClass.Create;
>    MyAbstractClass.Free;
> end.

'Casting' a class as abstract is curious syntax. What led you to think 
of that? But obviously the compiler knows it.
As soon as you add an abstract method the compiler will give a warning.

Howard





More information about the fpc-pascal mailing list