Author: Patrick N
Date: 16:02:44 10/09/03
Go up one level in this thread
On October 09, 2003 at 18:46:14, Gerd Isenberg wrote: >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 ;-) I'm not sure why you want to have a common base class here. Although the two different datatypes have the same operations, I don't think there is any benefit to a common base because all the operations are inline anyway. The base class would only be there to make it "look" more OO. If you need to hide the implementation and pass generic classes around, then the common base class starts to make more sense -Patrick > > >>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.