⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 marco.records.pas

📁 source code for Marco Cantu s book Delphi 2007 Handbook
💻 PAS
字号:
unit Marco.Records;

interface

type
  TMyRecord = record
  private
    one: string;
    two: Integer;
    three: Char;
  public
    procedure Print;
    // constructor Create; // causes error
    constructor Create (aString: string);
    procedure Init (aValue: Integer);
  end;

type
  TAnotherRecord = packed record
  private
    one: string;
    two: Integer;
    three: Char;
  public
    procedure Print;
    procedure Init (aValue: Integer);
  end;

implementation

uses
  SysUtils;

{ TMyRecord }

constructor TMyRecord.Create (aString: string);
begin
  writeln ('TMyRecord.Create called');
  one := aString;
  two := 2;
  three := '3';
end;

procedure TMyRecord.Init(aValue: Integer);
begin
  two := aValue;
  one := IntToStr (aValue);
end;

procedure TMyRecord.Print;
begin
  writeln (one, ' - ' , two, ' - ', three);
end;

{ TAnotherRecord }

procedure TAnotherRecord.Init(aValue: Integer);
begin
  two := aValue;
  one := IntToStr (aValue);
end;

procedure TAnotherRecord.Print;
begin
  writeln (one, ' - ' , two, ' - ', three);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -