I just wanted to ask a quick question.
I have a class called "ChessPiece"
#ifndef CHESSPIECE_H
#define CHESSPIECE_H
#include "Globals.h"
// Abstract class for inheritence
class ChessPiece {
public:
// Constructor
ChessPiece(bool isWhite) : m_isWhite(isWhite) {
}
// No dynamic allocation
~ChessPiece(void) {}
// pure virtual functions
virtual CellLocation *listAvailableMoves(void) = 0;
virtual char getPieceType(void) = 0;
virtual ChessPiece *clonePiece(void) = 0;
// ACCESSORS, MUTATORS
// isWhite member
bool isWhite(void) const{
return m_isWhite;
}
void setIsWhite(bool isWhite) {
m_isWhite = isWhite;
}
protected:
bool m_isWhite;
};
#endif
and I have a variable like this:
ChessPiece *m_gameBoard[8][8];
I wanted to know how can I define a pointer to this variable? I thought it'd be something like ChessPiece *(*pGameBoard)[8][8]
but it's not what I want. Say for example that I want to make call like this *pGameBoard[2][2]->isWhite()
(this doesn't work) How can I do this?
Thanks in advance for your answers.