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
In order to compile your code in XE2 just remove the
classKeyword of theDoSomethingelsedefinition, even if this code compile in older versions of delphi (I tested your code in Delphi 5, 7 and 2007) I don’t see the point (or difference) of declare a embedded (inner) procedure or function with theclasskeyword.