So I am trying to make a chess game ( bit of an ultimate challenge for me ), and I'm a stump for this part ..
So I made a piece object, and the idea is that in the main game code, I have an array of pieces and I pass the address of the array to the function "InitilisePieces" and the team ( Black or White ) and it shall assign all the pieces. So I made the function a friend to access all the private members and it comes up with an error saying "inaccessible", and I don't understand what's wrong with doing as I've done. Any help would be more than appreciated!
Side Note: things like State_ and _Location and structs and enums that are defined properly etc, not the problem ... ( I don't think )
Header File Contains:
class __Piece
{
private:
State_ e_state;
Piece_Type_ e_type;
Team_ e_team;
_Location st_location;
friend void InitilisePieces ( __Piece(*)[16], Team_);
public:
__Piece ();
};
.cpp File Contains:
void InitilisePieces ( __Piece * pao_piece[16], Team_ )
{
int n_count;
for ( n_count = 0; n_count < 16; n_count++ )
{
pao_piece[ n_count ]->e_state;
}
}
UPDATE:
Thankyou for the explanations and I get where I'm going wrong now ... so what is the parameter supposed to be to pass the address of an array of __Piece 's?