游子日月长

笑渐不闻声渐悄,多情却被无情恼!

导航

Delphi声明Record变量后直接初始化

 TARec = record
    A1: string;
    A2: string;
  end;

  TBRec = record
    A1: string;
    A2: string;
    ARec: TARec;
  end;

  PAppWindow = ^TAppWindow;
  TAppWindow = Record
    Width, Height : Integer;
    CaptionBarHeight : Integer;
  end;

var
  FARec: TARec = (A1: ''; A2: '');
  BRec: TBRec = (A1: ''; A2: ''; ARec: (A1: ''; A2: ''));
  i: Integer = 100;

  Window : TAppWindow = (Width:800; Height:600; CaptionBarHeight:26);

全局变量可以直接初始化,但是局部变量不允许。

posted on 2017-01-17 13:39  游子日月长  阅读(514)  评论(0编辑  收藏  举报