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 #44358 is a reply to message #44184] Fri, 10 June 2005 11:46 Go to previous messageGo to previous message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
wcramer wrote:
> I DON'T want to copy the code verbatim.
>
> For the "data" class, all parameters have names that include "X" and
> "Y" (like "MAXX", "XVALUES", etc.). For the "timedata" class, I
> overwrite many functions to modify the parameter names to include
> "TIME" and "VALUE" (like "MAXTIME", "TIMES", etc.). That's why the init
> parameters are different. Is there a better way to handle this?
>

I don't know that I really understand what you're trying to do. If I
happen to be really off base, just ignore me. Everyone else does. ;-)

Why go to the trouble of overwriting your parameter names? One of the
nice things about OO programming is that you can use the same interface
among many classes in a class hierarchy. This allows easy switching
between data, timedata, foodata and bardata without the need of changing
substantial areas of code or at least not needing to code special cases
all the time. Also, there is only one core interface to learn. While
the subclasses may and probably will have their own implementations of
methods and attach their own meanings to certain properties, the core
interface of the classes is the same.

It seems that instead of extending the data interface, you're trying to
redefine the interface. If the interface of data and timedata is the
same, you should be able to do what you want to do (dynamically
determine the class and return a new object of that class). By
redefining the interface, you're just causing more problems for
yourself. It seems that the only reason you're doing this is to give
more precise names to the inputs and keywords. By doing that, you're
uncoupling interfaces that should be related and consequently running
into problems because the interfaces don't match.

Is there anything else preventing you from having timedata and data use
the same interface?

-Mike
[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: Fri Oct 10 01:24:34 PDT 2025

Total time taken to generate the page: 0.16016 seconds