Re: Best Practice ?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Cor (non_at_non.com)
Date: 02/02/04


Date: Mon, 2 Feb 2004 16:05:52 +0100

Hi Jay B,

I seldom start a discussion with you and this one is very slippery ground
because I was you did a lot of investigations in the present time.

But with this one I had to think about Toms message to me about
encapsulation.

And this looks me someting for it.

My idea is, that when you have calculations, let say incometax for a
country, it has to be in one class and not a part of an other class.

And especialy not as part form a class (not a supplier) which has a function
in it that can be used in other programs.

My 2 cents, I am prepared to loose this discussion this time.

:-))

Cor

"Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP@msn.com> schreef in bericht
news:uxAmqyZ6DHA.3360@tk2msftngp13.phx.gbl...
> Marten,
> In addition to the other's comments.
>
> Can you provide more details on what you are attempting to accomplish?
>
> > I do
> > not think it is a good way to duplicate the calculate() function in both
> > classes.
> You are correct is not good to copy the code for Calculate into both A &
B.
> However both can have a method called Calculate that performs a different
> calculation based on being either an A or a B object.
>
> In addition to the others comments about Shared & Inherits: If a B object
> needs to call the Calculate method of an A object, then B needs either a
> class variable of type A, or B's method needs an A object as a parameter.
>
> Again can you provide more details, as I am not following what you want.
> Maybe include 10 to 15 lines of code to show what you have now, that you
are
> trying to avoid.
>
> Hope this helps
> Jay
>
> "Marten Van Keer" <marten@c3.be> wrote in message
> news:401e283e$0$781$ba620e4c@news.skynet.be...
> > Hello;
> >
> > Given a class A. class A has a function:
> >
> > calculate()
> >
> > Class A can calls another Class: B
> >
> > The problem is: Class B also wants to use the calculate() function. I
do
> > not think it is a good way to duplicate the calculate() function in both
> > classes.
> >
> > How do I solve such a problem ?
> >
> > Thanks in advance!
> > M.
> >
> >
> >
>
>



Relevant Pages

  • Re: speed up calculation suggestions
    ... Rather we duplicate rate calculations ... implemented by insurance companies. ... One could probably reasonably duplicate this through some ... My experience is that for "clean" codes, parallelizing with OpenMP can be quite easy (I spent just 3 hours on a 10K-line atmospheric-model code ...
    (comp.lang.fortran)
  • Problems with Regs programs crashing my PC
    ... I've been doing some investigations and calculations, using a couple of Reg's programs. ... I'm running XP Home without SP2 (so it's a DOS emulation), plus Norton Antivirus 2006 and Zone Alarm Pro 2007. ...
    (uk.radio.amateur)
  • Re: speed up calculation suggestions
    ... Rather we duplicate rate calculations ... One could probably reasonably duplicate this through some ... This is especially true for intel x87 floating ... Insurance companies are some that might still be using IBM ...
    (comp.lang.fortran)
  • Re: Removing URLs from SE index
    ... >> Okay, cannot figure out how to leave my 301 redirect from example.com to ... > BATE - program for pH calculations ... example.com from their index (in my mind, to reduce duplicate content ...
    (alt.internet.search-engines)
  • Re: Calculate without command button?
    ... complexity of the calculations since you would have to duplicate the ... calculations whenever you needed to use/display the field. ...
    (microsoft.public.access.formscoding)