I am migrating a scientific code from Java to C++. Please tell me:
a) What's wrong with the two functions?
b) How can I solve the problem? I can use the int** like a two dimensional array but not the Agent**.
I receive this error: "No operator = matches this operand".
In normal C we could assign NULL to pointers. We could also use a type** like a two dimensional array (i.e. a[i][j]) (two dimensional space for objectSpace and agentSpace is allocated somewhere else).
int** objectSpace;
Agent** agentSpace;
void Space::removeAgentAt(Point p)
{
agentSpace[p.x][p.y] = NULL;
}
void Space::putAgentTo(Agent agent, Point p)
{
agentSpace[p.x][p.y] = agent;
}