Method of what class? And how is the
agent object related to such class?
If the
agent
is a data member of the class then you may use something similar to:
class MyClass
{
Agent agent;
public:
void checkAndGo(int x, int y);
void MyClass::checkAndGo(int x, int y)
{
if (x==y)
agent.goto(x);
}
on the other hand, if
agent
isn't member of the class then you've to change the method's signature, for instance:
void checkAndGo(int x, int y, Agent & agent);