const organsim_cell &organisms::operator[] (int i) // access organism_cell at postion i
{
if ((i>=0) && (i<num_cells))
{
return orgs[i];
}
else // this is an error
{
cout << "Index out of range in organisms::operator[]()" << endl;
cout << "Exiting" << endl;
exit( );
}
return NULL;
}
class organisms
{
organism_cell orgs[MAX_CELLS]; // at most MAX_CELLS organisms will be present
int num_cells; // number of organism cells in use (determined
// while reading input file)
public:
organisms( ); // sets all organism cells to be dead
organisms(int size); // sets num_cells and makes all organisms dead
void set_size(int size); // change the size of the row
organism_cell &operator[](int i); // access organism_cell at postion i
const organisms &operator=(const organisms &O); // make row equal to that of O
booloperator==(const organisms &O); // check if rows are equal
};