free,destroy,destructor的区别?(50分)

看帮助文件
 
Free automatically calls the Destroy if the object instance is not nil.
Do not call Destroy directly in an application. Instead, call Free.
A destructor is a special method that destroys the object where it is called and deallocates its memory.
 
Destroy:释放对象内存,不过要注意,他不会将指针付为nil,如果你再调用destroy
则程序将出现Access Violation....异常。
free:是一个procedure ,他起的作用与Destory相似。只不过他要判断一下调用的
对象是否为nil,如果不是就调用Destory;不是,就返回。
destructor 是表示这个过程是释放对象内存的过程。我门一般使用Destroy,是因为
Delphi在TObject中将释放对象内存的过程声明为
destructor Destroy;
virtual;
我们如果也将destructor过程声明为Destroy;override,则可以使用TObject的指
针就可以真确释放我们自己的对象。当然也可以使用其他函数名,不过享受不到如此
方便的调用。
 
以后还是多看看帮助好
 
目前分不清楚先只用free就可以了
 
多人接受答案了。
 
<input name="hello" value="liuzheng">
 
顶部