Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Relaseing Instantiated classes
Message
 
À
01/09/1998 18:47:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00131909
Message ID:
00132141
Vues:
19
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform