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 #44192 is a reply to message #44098] Sun, 22 May 2005 23:28 Go to previous messageGo to previous message
Antonio Santiago is currently offline  Antonio Santiago
Messages: 201
Registered: February 2004
Senior Member
Before programming you need to stop and thing about your classes,
inheritance and relations.

> Methods such as "add" should return another object instance of the
> same class as "self".

Only for curiosity. ADD returns a new instance or the same instance with
the addition?

> Is there a way to get "add" to return a "timedata"
> object without having to copy the method verbatim from the "data"
> class to the "timedata" class?

Yes, don't write an "ADD" method for TIMEDATA and use the inherited from
DATA.

> The functionality is exactly the same, so I really don't want to do
> that.

what? Perhaps it hasn't got the same functionality. (Perhaps here, my
poor english doesn't bring me to use the correct words). That is, maybe
the concept is the same (the addition) but it is not the same integer
addition than "house" (objects) addition.

> Also, I can't dynamically define the class name for my call to obj_new
> because the init parameters are different.

Perhaps you can use keyword parameters in addition to some kind of
"template pattern". That is, you need your DATA::Init and TIMEDATA::Init
has the same positional parameters in addition to their respective
keyword parameters.
Now, you can call OBJ_NEW('DATA', d1) or OBJ_NEW('TIMEDATA', d1, XX=d2)
because they have the same parameters.


I don't know if this can be hopeful for you.
Bye.

--
-----------------------------------------------------
Antonio Santiago P�rez
( email: santiago<<at>>grahi.upc.edu )
( www: http://www.grahi.upc.edu/santiago )
( www: http://asantiago.blogsite.org )
-----------------------------------------------------
GRAHI - Grup de Recerca Aplicada en Hidrometeorologia
Universitat Polit�cnica de Catalunya
-----------------------------------------------------
[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: Sun Oct 12 12:18:17 PDT 2025

Total time taken to generate the page: 0.15893 seconds