Why do we need a post increment and pre increment operator overload?
In the following code, written by the designers of the course, there are four operator overloads for incrementation and decrementation, ++ and --. They have a post increment and a pre increment one there, and I don't understand what they are for. Why is there a post and pre overload for the operator?
#include<iostream>
usingnamespace std;
struct GRAPH
{
int x = 0;
int y = 0;
intoperator++()
{
x = x+1;
y = y+1;
return->this;
}
};
int main()
{
GRAPH graph1;
graph1++;
return 0;
}
I wrote an example program to try to figure it out but don't know what I'm doing or what exactly "this" is capable of doing.