zoukankan      html  css  js  c++  java
  • 拖管记录

    拖管记录

    DELPHI10.4开始支持 拖管记录。

    unit Unit1;
    
    interface
    
    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
    
    type
      TMyRecord = record
        Value: Integer;
        class operator Initialize (out Dest: TMyRecord);
        class operator Finalize(var Dest: TMyRecord);
      end;
    
    type
      TForm1 = class(TForm)
        Memo1: TMemo;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    class operator TMyRecord.Initialize (out Dest: TMyRecord);
    begin
      Dest.Value := 10;
      form1.Memo1.Lines.Add('created' + IntToHex (Integer(Pointer(@Dest))));
    end;
    
    class operator TMyRecord.Finalize(var Dest: TMyRecord);
    begin
      form1.Memo1.Lines.Add('destroyed' + IntToHex (Integer(Pointer(@Dest))));
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      var r: TMyRecord;
      memo1.Lines.Add(r.Value.ToString);
    end;
    
    end.
    

      测试:

    created0019F398
    10
    destroyed0019F398

  • 相关阅读:
    Zookeeper环境搭建
    Zookeeper介绍
    相关错题
    数据库前三章测试题
    数据库相关练习题
    SQL语句操作数据
    用表组织数据
    创建和管理SQL Server数据库
    登陆数据库
    C#部分试题实例
  • 原文地址:https://www.cnblogs.com/hnxxcxg/p/12970457.html
Copyright © 2011-2022 走看看