What do you mean by forward pointer?
Square (*fwd)() = (getColor() == White) ? &Square::up : &Square::down;
I believe you are saying that you are assigning a pointer to function returning Square, to a pointer to a Square. I think that's the problem you are having.
I'm not sure as I haven't done function pointers in a while but here goes anyway:
Square* (Square::*fwd)() = (getColor() == White) ? &Square::up : &Square::down;
Should fix the errors, I haven't thought about what it would solve though.
I'd be hesitant on the function pointer in the first place. It's almost always possible to get the same functionality in a different manner. Oh and don't forget the following either:
Quote:
|
Originally Posted by wikipedia
Unlike other pieces, the pawn does not capture in the same way as it moves. A pawn captures diagonally, one square forward and to the left or right. Any piece directly in front of a pawn, friend or foe, blocks its advance.
|