小编J. *_*ser的帖子

Delphi,记录类型属性,记录字段分配:分配给预期的记录的本地副本

在以上的问题“左边不能被分配到”在德尔福记录类型的属性,有一个答案椿Krijthe演示如何分配至创纪录的财产的字段可以由记录的声明中使用特性来完成。为便于参考,以下是Toon Krijthe发布的代码段。

type
  TRec = record
  private
    FA : integer;
    FB : string;
    procedure SetA(const Value: Integer);
    procedure SetB(const Value: string);
  public
    property A: Integer read FA write SetA;
    property B: string read FB write SetB;
  end;

procedure TRec.SetA(const Value: Integer);
begin
  FA := Value;
end;

procedure TRec.SetB(const Value: string);
begin
  FB := Value;
end;

TForm1 = class(TForm)
  Button1: TButton;
  procedure Button1Click(Sender: TObject);
private
  FRec : TRec;
public
  property Rec : TRec read FRec write FRec; …
Run Code Online (Sandbox Code Playgroud)

delphi compiler-errors record

8
推荐指数
1
解决办法
180
查看次数

标签 统计

compiler-errors ×1

delphi ×1

record ×1