I've created a class called Piece, which I used to create a 2D array in my main program.
This is the class:
namespace GG
{
class Piece
{
public int rank;
public int player;
}
}
And is instantiated in my main program like so:
namespace GG
{
public partial class frmPGame : Form
{
public frmPGame()
{
InitializeComponent();
}
Piece[,] board = new Piece[9, 8];
mathFunction mFunc = newMathFunction();
public void clear()
{
for (int y = 0; y < 8; y++)
{
for (int x = 0; x < 9; x++)
{
board [x, y] = new Piece();
board [x, y].rank = -1;
board [x, y].player = 0;
}
}
}
Now, I have ANOTHER class (named mathFunction) that does some math related work, and I would like to know if / how I can pass the array to it.
Do I instantiate "Piece" in the "mathFunction"? How do I pass the array and its contents from my main program to the "mathFunction"? And then how do I return it to main? Supposedly, I am to change some values in the 2D array.
Thanks in advanced.