How to declare type for a class procedure?

How to declare type for a class procedure?

type
  TTest = class
    procedure Proc1;
    class procedure Proc2;
    class procedure Proc3; static;
  end;

  TProc1 = procedure of object;
  TProc2 = ???;
  TProc3 = ???;

Comments

  1. Stefan Glienke  of course you are correct here :) seems there was a misunderstanding from my side.

    in the beginning of discussion I thought that
    TTest = class
       procedure x(param : integer);
       class procedure y(param : integer);
       class procedure z(param : integer); static;
    end;
    var a : TTest;

    then
    a.x(123) translates to x(a, 123);
    TTest.y(123) translates to y(nil, 123)
    TTest.z(123) translates to z(123)

    so here in TTest.x(123) compiler puts nil as parameter.
    so seems as I said, we were talking about different things :)

    ReplyDelete
  2. And you are wrong again, sorry.

    TTest.y(123) translates to y(TTest, 123)

    and TTest.x(123) does not compile because x is an instance method and not a class method (E2076).

    ReplyDelete
  3. Stefan Glienke  typo, TTest.y(123) not TTest.x().

    and yep, we found my initial mistake, as you said TTest.y(123) translates to y(TTest, 123) not to y(nil,123) as I said.

    ReplyDelete

Post a Comment