In main i'm declaring an object P:
Point P;
Then i'm trying to pass it and another Point object dest to use the ojbects:
int numOfPaths(Point P, int x, int y, Point dest, int n);
numOfPaths(P, x, y, dest, n);
Main.cpp is giving me no problems, but numOfPaths.cpp is giving me two errors, one for each of the Point objects.
"Identifier "Point" is undefined" and it points to each of the Points at the top of the function.
int numOfPaths(Point P, int x, int y, Point dest, int n)
^ ^
{
code for function
}
I'm pretty sure i'm passing the object wrong but I can't figure out how. Main compiles fine, so i'm not sure.
My other question is about overloading the == operator to compare two Point objects.
bool operator == (const Point &P) const;
is how its written in a public class of Point.
if(dest==P)
is when i'm calling it in numOfPaths.cpp. dest and P are my two objects i'm trying to compare. In my coding for the operator == I have:
bool Point:perator ==(const Point &P) const
{
bool result = false;
if(x = P.x && y = P.y)
result = true;
return result;
}
x and y are coordinates. I'm trying too see if point P is at point dest yet, so after P moves i compare P and dest. I'm getting two compiler errors that say x and P.x "must be a modifiable lvalue".
Thanks if you can help on either of these, i've already tried searching C++ board for passing objects but couldn't find anything related.