Board index » delphi » How do I think ancestor class?

How do I think ancestor class?

Hi,
I have two classes, A and B, which have two attribute "Description" kind =
string.
is it correct to create another class C  ancestor for A and B ?
 

Re:How do I think ancestor class?


On Mon, 27 Nov 2000 18:42:04 +0100, "antonio mantuano"

Quote
<anto...@aconet.it> wrote:
>is it correct to create another class C  ancestor for A and B ?

Are A and B the same type of things in your problem domain (i.e., in
the real world)?
--
Rick Rogers (TeamB); Fenestra Technologies, http://www.fenestra.com/
  Use Borland servers; posts via others are not seen by TeamB.
  For more info, see http://www.borland.com/newsgroups/genl_faqs.html

Re:How do I think ancestor class?


Quote
> Are A and B the same type of things in your problem domain (i.e., in the

real world)?

Ok, A is the class descriptor of the class B, in my appl. there are some
classes Bx derived
from A and for each ones there are Bx descriptors.
Therefore, A and B are different kind of things .
I'm lazy , and I think to write only one time the "Descriptor" attribute is
a nice idea....

Re:How do I think ancestor class?


On Mon, 27 Nov 2000 19:31:15 +0100, "antonio mantuano"

Quote
<anto...@aconet.it> wrote:
>Therefore, A and B are different kind of things .

I wouldn't make them share a common ancestor if they are different
things, particularly if the only thing shared is one string property.

Quote
> I'm lazy , and I think to write only one time the "Descriptor"
> attribute is a nice idea....

C'mon, it really isn't that much work.
--
Rick Rogers (TeamB); Fenestra Technologies, http://www.fenestra.com/
  Use Borland servers; posts via others are not seen by TeamB.
  For more info, see http://www.borland.com/newsgroups/genl_faqs.html

Re:How do I think ancestor class?


antonio mantuano ha scritto:

Quote

> > Are A and B the same type of things in your problem domain (i.e., in the
> real world)?

> Ok, A is the class descriptor of the class B, in my appl. there are some
> classes Bx derived
> from A and for each ones there are Bx descriptors.
> Therefore, A and B are different kind of things .
> I'm lazy , and I think to write only one time the "Descriptor" attribute is
> a nice idea....

Maybe you can define an interface "Descriptor" implemented by some
class, make A and B implement that interface and delegate the interface
implementation in both to a third class.

Hope it help.
bonny

Other Threads