A procedure’s class and object cannot be declared local in your delphi program.
program Produce;
procedure MyProc;
type
TMyClass = class
Field: Integer;
end;
begin
(*...*)
end;
begin
end.As a result, MyProc attempts to specify a class type locally, which is forbidden.
program Solve;
type
TMyClass = class
Field: Integer;
end;
procedure MyProc;
begin
(*...*)
end;
begin
end.The solution is to shift the class or object type declaration to the global scope.
Leave a Reply