|
Re: object association [message #72388 is a reply to message #72386] |
Thu, 02 September 2010 09:16  |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On 9/2/10 7:57 AM, nata wrote:
> FUNCTION a::Init
> RETURN, 1
> END
>
> PRO a__define
> struct = { a, int: 0, str: '' }
> END
>
> ## Class b
>
> FUNCTION b::Init, a
> self.reference=a
> RETURN, 1
> END
> PRO b::test
> self.reference.int=9
> END
> PRO b__define
> struct = { b, $
> reference: OBJ_NEW() }
> END
>
> #############################
>
> My code will be something like:
> a=OBJ_NEW('a')
> b=OBJ_NEW('b',a)
> b->Test
In one of those oddities of IDL, you should be able to access the
instance variables of *any* object when inside *any* method. IDL is just
having a hard time parsing your expression.
Try this for your b::test method:
PRO b::test
a = self.reference
a.int = 9
END
Mike
--
www.michaelgalloy.com
Research Mathematician
Tech-X Corporation
|
|
|