comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Recursive Objects
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Recursive Objects [message #26991 is a reply to message #26990] Tue, 09 October 2001 08:49 Go to previous messageGo to previous message
Karl Schultz is currently offline  Karl Schultz
Messages: 341
Registered: October 1999
Senior Member
"Francesco Belletti" <guenhwyvar@libero.it> wrote in message
news:e7b4ed30.0110090547.79d8e345@posting.google.com...
> Hello,
> I'm a very beginner with IDL so I'm sorry if my question is too
> stupid.
> I need to store a object reference in an object structure:
>
> pro my_obj__define
> struct = {my_obj, another_obj:OBJ_NEW()}
> end

This is correct. OBJ_NEW() just puts a null object ref in your struct,
which is what you want at this point.

> After another_obj is zeroed during object creation, it couldn't no
> more be used as an object reference!!
> I've tried to redeclare it
>
> another_obj=OBJ_NEW()

This just puts another null object ref in your structure.

You probably want to create this object in your ::Init method:

function my_obj::Init
self.another_obj = OBJ_NEW('SomeOtherClass')
return, 1
end

Your class "my_obj" is creating an instance of some other object of class
"SomeOtherClass" when it initializes, presumably because your class "my_obj"
needs the services of "SomeOtherClass". Depending on what your "my_obj"
class does, you can instead create the object of class "SomeOtherClass" at
some other time than in the ::Init method, but that all depends on when you
need it.

Also note that you do not need to explicitly destroy this instance of
"SomeOtherClass" in the my_obj::Cleanup method. Since the objref is in the
class struct, IDL will find and destroy it for you.

Karl
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Error propagation expressions
Next Topic: CURSOR question

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Nov 29 18:18:18 PST 2025

Total time taken to generate the page: 1.76403 seconds