Nested Class functions don't compile

I am upgrading some legacy 3rd party components from Delphi 6 source up to XE2.

The 3rd party source has nested class function within a class procedure. Mock up exact working copy which will fail:

type
  TMyClass1 = class
  public
    class procedure DoSomething;
  end;

{ TMyClass1 }

class procedure TMyClass1.DoSomething;
  class function DoSomethingelse: boolean;
  begin
    result := false;
  end;
begin

end;

trying to compile this gives an error about doSomethingelse being an undeclared identifier. Now I can (presumably) resolve this by pulling the nested function out to the same level, but is there a compiler option that I can set to prevent this? Is this something which has recently changed? Has anyone else come across this issue?

Thanks


为了在XE2中编译你的代码,只需删除DoSomethingelse定义的class关键字,即使这个代码是在旧版本的delphi中编译的(我在Delphi 5,7和2007中测试了你的代码),我没有看到(或差异)声明一个嵌入式(内部)过程或函数与class关键字。

链接地址: http://www.djcxy.com/p/59880.html

上一篇: Delphi XE2是否删除了IsWinNT函数?

下一篇: 嵌套类函数不能编译