Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Release Property
Message
From
21/12/1999 15:51:24
 
 
To
21/12/1999 11:18:44
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00306719
Message ID:
00306923
Views:
28
>Hi,
> I have a property of myclass that store the reference of an object. How to RELEASE the property? I try myclass.oObjRef = .NULL.
>does it RELEASE the object?
>

If no other object references to that oibject instance exist, yes, that will release the object. If other references to the object exist, the object will continue to exist until either all the object references to it are gone, or you explicitly trigger the release. A simple example:
oObject1 = CREATEOBJ('MyClass')
oObject2 = oObject1  && two references to the same object
oObject1 = NULL && object still exists because oObject2 still references it
oObject2 = NULL  && object releases since no references exist

oObject3 = CREATEOBJ('MyClass')
oObject4 = oObject3  && again, two references
? ISNULL(oObject4)
oObject3.Release() && the object destroys itself even though other object refs exist
? ISNULL(oObject4)  && now null since the object is gone

oObject5 = CREATEOBJ('MyClass')
oObject5.AddProperty('oObjRef')
oObject5.oObjRef = CREATEOBJ('SomeClass')
oObject5.oObjRef = NULL  && object goes away
* oObject5.oObjRef.Release() would kill it, too.
* as would oObject5 = NULL
NOTE: NOT ALL CLASSES HAVE A RELEASE METHOD!!!! Classes based on the CUSTOM class, for example, do not have a native Release
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform