Sorry, I should have written...
"add code to destroy/remove (by setting the referring member to .null. or whatever) the lower-level object in the destroy() event of the upper-level class"
...to make it clearer. I didn't mean (or write) 'add a call to destroy()...', I meant 'add code to remove (destroy, eliminate, etc.)...' or somesuch.
My fault for being lazy.
The destroy() event for the upper-level object will be invoked prior to the invocation (if any) for the lower-level, IIRC, and at that point destruction / removal (or whatever) of the lower-level objects can be performed.
>Robert,
>
>Destroy() is an
event, it is a
notification that an object is being removed from memory because there are no more object references to it. This gives you a chance to do any final clean up before it's gone.
>
>You
can not call the Destroy() with the intent of causing the object to destruct it simply won't happen. Do this code in the command window one line at a time:
>
>
ox = createobject( "form" )
>ox.Visible = .t.
>
>? ox.Destroy()
>
>ox = .null.
>
>If you turn on event tracking in the debugger you can see that Destroy is triggered only once the ox = .null. executes. It does not happen when the ? ox.Destroy() is called.
>
>>Well, add a call to destroy the lower-level class in the destroy() function of the upper-level class.