[fpc-pascal] Class procedural type

Ewald ewald at yellowcouch.org
Mon Dec 17 17:39:56 CET 2012


Hello,

Is there any way to define the appropriate type for `AMethod` (in mode
ObjFPC)?

    TTestClass = Class
    Public
        Class Procedure AMethod;
    End;

I tried
    Type TSomeType = Class Procedure;

But this didn't work. Rather obvious of course since this could also be
interpreted as a class named `Procedure` [I think].

Also I tried
    Type TSomeType = Class Procedure of Object;

But this didn't get me any further. I read the manual (section 3.6 --
http://www.freepascal.org/docs-html/ref/refse17.html) and it contains no
data in respect to this little problem of mine.

Any ideas?

BTW: For time being I fixed it through
TProcType(Pointer(@TTestClass.AMethod)), where `TProcType = Procedure;`.
I think this boiles down to the same as a class procedure is nothing
more than a normal procedure as I see it (except for the name and some
other syntax)

-- 
Ewald




More information about the fpc-pascal mailing list