I create this function in a class and I receive error: pointer to incomplete class type is not allowed.
As far as I am concerned however it is possible to declare an array of pointers to an object of an abstract class. After that you can pass objects of the derived class in the array. Where is the problem with this code (class Square is abstract):
public:
Player(int,int);
void captureSquare(Square* []);
void Player::captureSquare(Square* allSquares[22])
{
for(int i=0;i<22;i++){
Square* OnSquare = allSquares[i];
if(OnSquare->getID==squarePosition){
capturedSquare = OnSquare;
break;
}
}
}
OnSquare->getIDshould probably beOnSquare->getID()