Yes, you are right.
Due to the problem that I couldn't store a class function in a var of
type function of object (I reported earlier) I found a workaround:
var
MyVar: function: boolean of object;
...
MyVar:=@TSomeClass(nil).MyClassFunc;
and that's why Self is nil. But I can do
MyVar:=@TSomeClass(TSomeClass).MyClassFunc;
which solves all problems (so far). :)
On 07.08.2012 11:52, Jonas Maebe wrote:
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
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal