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

Home » Public Forums » archive » Re: keyword inheritance and object inheritance
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: keyword inheritance and object inheritance [message #29896 is a reply to message #29893] Sat, 23 March 2002 12:45 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ben Tupper (btupper@bigelow.org) writes:

> I really don't understand how to retrieve object properities when it
> comes to multiple object inheritance.

I'm pretty sure you are not alone, Ben. I *thought*
I understood it, but I spent two hours getting your
example to work. Although, as it happened, I had
the problem solved in five minutes, but I was mistyping
"grandma" as "gra*m*dma". No wonder is was always
undefined. Typical, I'm afraid. :-(

Anyway, after the jolt of Starbuck's put me onto
the right track, I think I really do understand
it how. At least I tried every single one of the
perturbations at least 5 times. :-)

Here is the rule of thumb I would use. On every
GetProperty method, I would *define* a _Ref_Extra
keyword. But on every *call* to a GetProperty method
I would use an _Extra keyword to pass the extra
structure.

For example, here is how you wrote the GetProperty
methods for your "mine" example:

;-----
; Getproperty
;-----
PRO grandmother::GetProperty, grandma = grandma
grandma = self.grandma
END

;-----
; GetProperty
;-----
PRO mother::GetProperty, mom = mom, _Ref_Extra = Extra
mom = Self.mom
Self->grandmother::GetProperty, _Extra = extra
END

;-----
; GetProperty
;-----
PRO myobj::GetProperty, me=me, _Extra = Extra
me = Self.me
Self->mother::GetProperty, _Extra = extra
END

And here is how I changed them to get them to work
as you expected them to:

;-----
; Getproperty
;-----
PRO grandmother::GetProperty, grandma = grandma, _Ref_Extra=extra
grandma = self.grandma
END

;-----
; GetProperty
;-----
PRO mother::GetProperty, mom = mom, _Ref_Extra = Extra
mom = Self.mom
Self->grandmother::GetProperty, _Extra = extra
END

;-----
; GetProperty
;-----
PRO myobj::GetProperty, me=me, _Ref_Extra = Extra
me = Self.me
Self->mother::GetProperty, _Extra = extra
END

Here is the result of my changes:

IDL> mine = Obj_new('MyObj', 'Mudd', 'Mom', 'Granny')
IDL> mine->SetProperty, Grandma = 'Nana', Mom = 'Mum', Me = 'Pooh'
IDL> mine->GetProperty, Grandma = Grandma, Mom = Mom, Me = Me
IDL> help, grandma, mom, me
GRANDMA STRING = 'Nana'
MOM STRING = 'Mum'
ME STRING = 'Pooh'

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: keyword inheritance and object inheritance
Next Topic: Re: DIRECT GRAPHICS VS OBJECT GRAPHICS

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

Current Time: Wed Oct 08 18:44:15 PDT 2025

Total time taken to generate the page: 0.28700 seconds