Author: Sven Reichard
Date: 09:02:36 06/30/02
Go up one level in this thread
On June 30, 2002 at 08:45:51, Daniel Clausen wrote: >On June 29, 2002 at 09:26:08, Russell Reagan wrote: > >>On June 29, 2002 at 05:32:08, Daniel Clausen wrote: >> >>>Bad dependencies will hurt, sooner or later. >> >>So if I use the move->toString(ALGEBRAIC, &position); approach, is that being >>dependant? Also, what do you mean that it will hurt sooner or later? How will >>it cause problems? If I later decide to change how move or position is >>implemented, then I will have to change the other accordingly. >>Is that what you mean? >> > >I assume that you have a header-file Move.h which contains a >prototype/declaration for the method toString. Therefore this header file has to >include Position.h (assuming this thing is in its appropriate header file - many >people prefer to have a Types.h or Common.h for often-used data-structures) No. You can declare (though not define) pointers or references without having the class definition. It suffices to put class position; before the definition of the class move. >Now at every place where you include 'Move.h', you indirectly also include >'Position.h', which can cause circular includes later. Sometimes this is not a >problem (although it's not really good from a design POV), and sometimes it >causes problems and you have to resolve these with forward declaration. Exactly. A simple forward declaration solves the problem here. You just have to decide if "algebraic notation" conceptually belongs to the move class, or if it is rather an independent class. However, this is just a question of aesthetics, which for some people - including me - is quite important. Sven. >Sargon
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.