Alright I am reading Practical C++ and this is what I am confused about.
struct Point2d
{
float x;
float y;
};
Point2d operator-(const Point2d& p1, const Point2d& p2);
Point2d Subtract(const Point2d& p1, const Point2d& p2);
Point2d operator-(const Point2d& p1, const Point2d& p2)
{
Point2d pt;
pt.x = p1.x - p2.x;
pt.y = p1.y - p2.y;
return pt;
}
Point2d Subtract(const Point2d& p1, const Point2d& p2)
{
Point2d pt;
pt.x = p1.x - p2.x;
pt.y = p1.y - p2.y;
return pt;
}
later on it goes to
Point2d pt1 = {10.0f, 16.0f};
Point2d pt2 = {8.0f, 7.0f};
Point2d pt3 = Sbutract(pt1, pt2);
pt3 = pt1 - pt2;
what I am wondering don't you have to pass the parameters in with the same name shouldn't pt1 and pt2 be p1 and p2??