Re: Best Practice ?
From: Cor (non_at_non.com)
Date: 02/02/04
- Next message: Nathan: "Accessing variables in referenced class library"
- Previous message: Herfried K. Wagner [MVP]: "Re: Can I change more than one control's properties at the same time?"
- In reply to: Jay B. Harlow [MVP - Outlook]: "Re: Best Practice ?"
- Next in thread: Jay B. Harlow [MVP - Outlook]: "Re: Best Practice ?"
- Reply: Jay B. Harlow [MVP - Outlook]: "Re: Best Practice ?"
- Messages sorted by: [ date ] [ thread ]
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.
> >
> >
> >
>
>
- Next message: Nathan: "Accessing variables in referenced class library"
- Previous message: Herfried K. Wagner [MVP]: "Re: Can I change more than one control's properties at the same time?"
- In reply to: Jay B. Harlow [MVP - Outlook]: "Re: Best Practice ?"
- Next in thread: Jay B. Harlow [MVP - Outlook]: "Re: Best Practice ?"
- Reply: Jay B. Harlow [MVP - Outlook]: "Re: Best Practice ?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|