delphi中record作为函数参数,为什么提示未定义?

来源:百度知道 编辑:UC知道 时间:2024/05/29 23:13:16
1. unit Unit1;
2.
3. interface
4.
5. uses
6. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7. Dialogs;
8.
9. type
10. TForm1 = class(TForm)
11. private
12. { Private declarations }
13. public
14. function getWaht(what:TWhat):integer; //这里提示TWhat未定义????
15. { Public declarations }
16. end;
17.
18. TWhat = record
19. a:string;
20. b:string;
21. c:integer;
22. end;
23.
24. var
25. Form1: TForm1;
26.
27. implementation
28.
29. {$R *.dfm}
30.
31. end.

为什么14行里提示未定义????

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TWhat = record
a:string;
b:string;
c:integer;
end;
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
function getWaht(what:TWhat):integer; //这里要在TWhat定义之后
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

{ TForm1 }

function TForm1.getWaht(what: TWhat): integer;
begin
// getWaht
end;

end.