对Object Pascal编译器给类对象分配堆内存细节的一种大胆猜测(下)[4]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 mahongxi 的 blog

在构造方法内你的代码前,安插了代码调用newinstance方法,析构时,则在析构函数中你的代码后,调用freeinstance函数。

 

那么,现在再来看这种情况:派生

tbase = class(tobject)

    x : integer;

    y : double;

    class function newinstance: tobject; override;

    procedure freeinstance; override;

    constructor create;

  end;

 

  tsub = class (tbase)

    m : integer;

    n : double;

    constructor create;

 end;

 

本文关键:Object Pascal 分配内存
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top