Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Relaseing Instantiated classes
Message
 
To
01/09/1998 18:47:24
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00131909
Message ID:
00132141
Views:
20
>If you call x.Release(), then you don't need x = .NULL. because x is already .NULL.
>
>If you assign x = .NULL., then the object is released anyway, so, no need for x.Release().
>
>But if you can do either of these, then it means you know the name of the variable, so, you can also RELEASE X. Back to step 1...
>
>Vlad
>
>>If classx doesn't have a Release metod then give it one and put RELEASE THIS in that method. Then when you want to destroy the object simply x.Release() and then x = .NULL.

Paul,

If x is an external reference to an object adn you RELEASE THIS from within the object then the object will not release until you clear the external reference to it, therefore the need for x = .NULL.

As for RELEASE Object versus Object.Release() the former assume total control over the destruction of another object whose state may ro may not be know at the time. The latter, Object.Release(), requests that the object release itself (it knows its current state and can do whatever it needs to to clear that state and prepare for destruction). It is always a better design to allow an object to be responsible for its own destiny.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform