Suppose I define this structure:
struct Point {
double x, y;
};
How can I overload the +
operator so that, declared,
In C++ there's only one difference between a struct and a class: in a struct the default visibility is public while in a class it is private.
Other than that you can do anything you would do in a class in a struct and it will look exactly the same.
Write operator overloading in a struct as you would in a class.