我有两条具有相同字段的记录,其中一条有一组程序。为什么两条记录的大小相同?
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils;
type
TData = record
Age : Byte;
Id : Integer;
end;
TData2 = record
Age : Byte;
Id : Integer;
procedure foo1;
procedure foo2;
procedure foo3;
end;
procedure TData2.foo1;
begin
end;
procedure TData2.foo2;
begin
end;
procedure TData2.foo3;
begin
end;
begin
try
Writeln('SizeOf(TData) = '+ IntToStr(SizeOf(TData)));
Writeln('SizeOf(TData2) = '+ IntToStr(SizeOf(TData2)));
Readln;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.