View Single Post
Old May 12th, 2006, 7:38 AM   #2
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
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.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates

Last edited by nnxion; May 12th, 2006 at 7:56 AM. Reason: missed colons
nnxion is offline   Reply With Quote