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

Home » Public Forums » archive » Need advice about 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: Need advice about inheritance [message #44303 is a reply to message #44182] Tue, 07 June 2005 10:48 Go to previous messageGo to previous message
wcramer is currently offline  wcramer
Messages: 9
Registered: February 2005
Junior Member
Sorry that it's taken me so long to respond to your post, "Mr. A"; I
got sidetracked with something else.

Let's do this with code so it will be more clear. Here's what I have:

function data::add,data2
...
result = obj_new('data', <data init params>)
...
return, result
end

I want this function to return a TIMEDATA object if called with a
TIMEDATA object. There are two ways that I can think of to do this:

(1) Override the ADD function in the TIMEDATA class:

function timedata::add,timedata2
...
temp = data::add(timedata2)
result = obj_new('timedata', data = temp)
...
return, result
end

I really don't want to do this.

(2) Dynamically pass the class type to OBJ_NEW:

function data::add,data2
...
result = obj_new(obj_class(self), <common data/timedata init params>)
...
return, result
end

The problem with this method is that I define the INIT parameters as
keyword parameters, and the parameter names are different for DATA and
TIMEDATA. I can't convert the parameters to positional parameters
because INIT allows multiple possibilities of initialization (MATRIX,
SIZE, or X/TIMES and Y/VALUES)

Is there a better way to do this that I haven't thought of?

Thanks,
Doug
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: array of pointers inside a structure
Next Topic: Re: mosaic two images in direct graphics

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

Current Time: Sat Oct 11 01:51:21 PDT 2025

Total time taken to generate the page: 0.55888 seconds