Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: C++ class design question

Author: Gerd Isenberg

Date: 15:46:14 10/09/03

Go up one level in this thread


On October 09, 2003 at 18:08:41, Patrick N wrote:

>I'd say it depends on what exactly you are trying to do.  Are you trying to have
>a common class with different implementations depending on what hardware is
>available or different implementations which you use at the same time?
>If you want a common class, you could have one header but different
>implementations (using different source files and/or preprocessor).

Hi Patrick,

I understand, i want to use them simultaniously in one routine to gain more
parallel performance with different register files.

>One example
>I use like this is a thread class.  This way I can have a common interface for
>both posix threads and windows threads.  I use the same header file, but
>different implementations depending on the platform.
>If you are trying to use two different approaches to storing data in the same
>algorithm, I recommend two different classes, but have operators that can
>convert easily between them.

I tend to favor this solution too.

One possible pro for a common base: Member incarnations with instanciable base,
register incarnation with two derivates. Assignment, copy constructurs only from
base to derivates, but not between derivates (different register files). Kind of
OO-perversion ;-)


>Hopefully this is helpful.

Yes, thanks for your suggestions.

Gerd

>-Patrick
>
<snip>



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.