I have the following header:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
#ifndef PLAYER_H
#define PLAYER_H
#include<iostream>
#include<cmath>
#include<string>
class TicTacToe;
class Player
{
public:
Player(char name[], int index);
int GetIndex();
char* GetName();
void NextMove(TicTacToe & board);
private:
char* PlayerName[15];
int PlayerId;
int TotalMoves;
};
#endif
|
And the following implementation:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#include "player.h"
Player(char name[], int index)
{
strcpy(PlayerName, name)
PlayerId = index;
}
int GetIndex()
{
return PlayerId;
}
char* GetName()
{
return PlayerName;
}
void NextMove(TicTacToe & board)
{
}
|
And I get the following errors on compile:
player.cpp:3: parse error before `char'
player.cpp: In function `int GetIndex()':
player.cpp:11: `PlayerId' undeclared (first use this function)
player.cpp:11: (Each undeclared identifier is reported only once
player.cpp:11: for each function it appears in.)
player.cpp: In function `char * GetName()':
player.cpp:16: `PlayerName' undeclared (first use this function)
I have no clue what I'm doing wrong but anything to point me in the right direction would be appreciated.