Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Thread Tools Display Modes
Old 01-23-2007, 01:33 AM
delsq delsq is offline
Junior Member
Join Date: Jan 2007
Posts: 12
Default delphi


After destroy can we use object before null in delphi?
Reply With Quote
Old 01-23-2007, 02:12 AM
Norrit Norrit is offline
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,335
Default RE: delphi

After driving can we use car before washing in garage?

In other words: What do you mean ???

Objective reality is a delirium caused by lack of alcohol in blood.
There is no place like
Reply With Quote
Old 01-23-2007, 02:28 AM
daltamira daltamira is offline
Senior Member
Join Date: Aug 2006
Location: Argentina
Posts: 959
Default RE: delphi

No, you cannot. After destroying the object, the reference to this one is lost, this way, you cannot use it again.
Reply With Quote
Old 01-26-2007, 11:07 AM
digitiger digitiger is offline
Senior Member
Join Date: Jan 2001
Posts: 716
Default RE: delphi

First thing is that normally you should not destroy the objects in delphi until and unless you are sure as what you want to do and why. Delphi provides another method "FREE" for this, which will first check if object is not already freed and then only try to destroy that.

Even better one is FreeAndNil() which first checks if object is valid and then free it if required and then also sets its pointer to NIL.

Comming back to your question as using object after destroying it and before it is null. The moment any object is destroyed its pointer become invalid and thus cannot be used at all.

Hope it helps and if it does then do accept the answere

Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

All times are GMT. The time now is 07:24 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.