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

Home » Public Forums » archive » Re: Puzzling over inherited objects
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Puzzling over inherited objects [message #84569] Tue, 04 June 2013 15:24
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Helder writes:

> Thanks David for giving me the answer (in a book...).

Saves me a lot of time. ;-)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Puzzling over inherited objects [message #84570 is a reply to message #84569] Tue, 04 June 2013 15:10 Go to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Tuesday, June 4, 2013 11:51:47 PM UTC+2, Helder wrote:
> Hi,
>
> I'm quite new to using objects and wanted to do a bit more with what I have been doing until now (not much anyway...). So here is the deal.
>
> I want to create an object that incorporates (inherits?) the a typical object such as IDLanROI. So that the structure definition would look like this something like this:
>
>
>
> class = {MyRoiObj, INHERITS IDLanROI, IDNr:0L}
>
>
>
> where I simply added an ID to each IDLanROI. I still want to have all the functionality of the methods associated with IDLanROI.
>
>
>
> The problem is: how would I assign the object (properties of) IDLanROI to my new object in the init function? I guess (and I'm quite sure) that something like
>
> self = obj_new('IDLanROI')
>
> or
>
> void = obj_new('IDLanROI')
>
> struct_assign, self, void
>
>
>
> will not work. So the only solution I see at the moment is to create the structure as:
>
>
>
> class = {MyRoiObj, IDLanROI_ref:OBJ_NEW(), IDNr:0L}
>
>
>
> And then in the init or whereelse, assign the object as:
>
> self.IDLanROI_ref = obj_new('IDLanROI')
>
>
>
> So here is the question... is there a better way to do this? Ideally objects are made with inheritance... I simply can't find a way to use that in my case.
>
>
>
> Any suggestions?
>
>
>
> Thanks,
>
> Helder

Ok... I did my homework and found the answer in "IDL Programming Techniques". I need to call in my init method the init method of the superclass object.

ok = self->IDLanROI::init()

This did it.

I also checked, and I'm quite happy of that, I can use DRAW_ROI on the subclass object.

Thanks David for giving me the answer (in a book...).
Cheers,
Helder
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: upsampling images
Next Topic: Re: How do I get IDL to place a string array into a netdcf file attribute?

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

Current Time: Wed Oct 08 13:33:55 PDT 2025

Total time taken to generate the page: 0.00446 seconds