#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
class TicTacToe
{
private:
char board[3][3];
int GameStatus;
int TotalMoves;
public:
TicTacToe();
bool SetValue(int row, int column, int player);
int GetStatus();
};
player.cpp: In method `void Player::NextMove(class TicTacToe &)':
player.cpp:33: no matching function for call to `TicTacToe::SetValue (int &, int
&, int &)'
I see no reason why that should be occurring, I think you must have miscopied the code or something, usually those kinds of errors result from inconsistent declarations of the functions.
I've copied the code exactly as I have it saved. I 've been messing around with it for a hour or two now and always end up with the same error. The following driver file works fine if the code that throws the error is commented out:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include<iostream>
#include "tic_tac_toe.h"
#include "player.h"
#include <new>
usingnamespace std;
int main()
{
char name[5];
TicTacToe * test = new TicTacToe;
Player * test2 = new Player(name,1);
test2->NextMove(*test);
cout << test->SetValue(3,3,4);
}