[fpc-pascal] class of a class function

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Aug 7 11:52:23 CEST 2012


CA Gorski wrote on Tue, 07 Aug 2012:

> I tried that already, but at least in my case Self is Nil inside the  
> class function.
> Compiler (fpc 2.6.1 ) bug?

It does not return nil for me:

***
{$mode objfpc}

type
   TSomething = class
     class function GetMyClass: TClass;
   end;

class function TSomething.GetMyClass: TClass;
begin
   Result:=self;
end;

begin
   writeln(ptrint(TSomething.GetMyClass));
end.
***


Jonas



More information about the fpc-pascal mailing list