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

Home » Public Forums » archive » Re: Object within an Object's Structure
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: Object within an Object's Structure [message #71279] Wed, 09 June 2010 12:34
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 6/9/10 1:12 PM, carl wrote:
> Hello,
>
> I am trying to make use of what OOP functionality IDL has, and I wish
> to have as an object variable another object of a different type.
>
> Is this possible? If so, how do I specify this?
>
> I have an object type orbitingBody, and want to make an object
> orbitingPair. Would this work? how would it be then coded in my init
> function?
>
> pro orbitingpair__define
> struct = { orbitingPair,
> planet: obj_new('orbitingbody', args)
> star: obj_new('orbitingbody', args)
> etc...}
> end
>
> thanks,
>
> Carl

For object's instance variables, the definition of the type of the
variable is done separately from the creation of the variable. So in
your case:


function orbitingpair::init

self.planet = obj_new('orbitingbody', args)
self.star = obj_new('orbitingbody', args)

return, 1
end

pro orbitingpair__define
define = { OrbitingPair, $
planet: obj_new(), $
star: obj_new() $
}
end

Mike
--
www.michaelgalloy.com
Research Mathematician
Tech-X Corporation
[Message index]
 
Read Message
Previous Topic: Problem with creating executable files for scripts using envi functions
Next Topic: Re: Using STREGEX/STRMID

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

Current Time: Fri Oct 10 15:09:09 PDT 2025

Total time taken to generate the page: 1.36175 seconds