I have class A and method call a_method, I have class B with and object b_object, and I wanted to pass object b_object as an argument into a_method, but how do I declare it in a_method?
#include <iostream>
#include <vector>
class Board{
int sizeofboard;
std::vector<std::vector<int>> board;
public:
Board(int sizeofboard){
this->sizeofboard = sizeofboard;
int n = 1;
for (int i = 0; i < sizeofboard; i++){
board.push_back(std::vector<int>());
for (int j = 0; j < sizeofboard; j++){
board[i].push_back(n);
n++;
}
}
}
display(){
for (int i = sizeofboard-1; i >= 0; i--){
std::cout << " ";
for (int j = 0; j < sizeofboard; j++){
if (j == sizeofboard-1){
std::cout << board[i][j];
continue;
}
std::cout << board[i][j] << " | ";
}
std::cout << std::endl;
if (i == 0)continue;
std::cout << "---+---+---" << std::endl;
}
}
draw(int position, Player &player){
int i, j;
int i = position/3;
if (i == 0)i = 2;
j = position%3;
}
};
class Player{
char symbol;
public:
};
int main()
{
Board board(3);
Player player1;
board.display();
return 0;
}
so the part of draw I am confused on how to declare it. it says Player has not been declared