2、什麼使用時候使用Release方法首先我們為測試單元加入use:Generics.Collections,再將TTestClass類修改如下:type
運行失敗了,原因是在DoTestAutoPtr方法退出了以後,TAutoPtr<TTestClass>.New(TTestClass.Create
三、解決問題在解決問題之前,我們先進行如下的規定:TAutoPtr<T>中的T智能傳入Class類型或指針類型,不能傳入如Integer、reco
而_Finalize方法是做對有類型的指針(如:PGUID)所指向的結構體變量的一些“善後工作”,如果為純Pointer,_Finalize方法內將不執行:a
五、完整代碼{******************************************************** Delphi Smart Po
//TStringBuilder.Append 截取字符數組和字符串procedure TForm1.Button2Click(Sender: TObject
窗體文件:object Form1: TForm1 Left = 0 Top = 0 Caption = Form1 ClIEntHeight = 224 C
窗體文件:object Form1: TForm1 Left = 0 Top = 0 Caption = Form1 ClIEntHeight = 209 C
窗體文件:object Form1: TForm1 Left = 0 Top = 0 Caption = Form1 ClIEntHeight = 207 C
窗體文件:object Form1: TForm1 Left = 0 Top = 0 Caption = Form1 ClIEntHeight = 187 C
窗體文件:object Form1: TForm1 Left = 0 Top = 0 Caption = Form1 ClIEntHeight = 162 C
窗體文件:object Form1: TForm1 Left = 0 Top = 0 Caption = Form1 ClIEntHeight = 141 C
代碼文件:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, G
窗體文件:object Form1: TForm1 Left = 0 Top = 0 Caption = Form1 ClIEntHeight = 147 C
窗體文件:object Form1: TForm1 Left = 0 Top = 0 Caption = Form1 ClIEntHeight = 165 C
窗體文件:object Form1: TForm1 Left = 0 Top = 0 Caption = Form1 ClIEntHeight = 153 C
單元(Unit1):unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Class
窗體文件:object Form1: TForm1 Left = 0 Top = 0 Caption = Form1 ClIEntHeight = 114 C