I'm studying operator overloading and can not understand how that is identified using the + + operator pre-set or post-set.
------ CODE --------------------------------------------------
#include <iostream>
using namespace std;
class ponto
{private:
int x,y;
public:
ponto(int x1=0, int y1=0) {x=x1;y=y1;} // Constructor
ponto operator ++() //Function operator PRE-FIXED
{
++x;++y;
return ponto(x,y);
}
ponto operator ++(int) //Function operator POS-FIXED
{
++x;++y;
return ponto(x-1,y-1);
}
void printpt() const
{
cout <<'('<< x <<','<<y<<')';
}
};
void main()
{ponto p1,p2(2,3),p3;
cout << "\n p1 = "; p1.printpt();
cout << "\n p2 = "; p2.printpt();
cout << "\n++p1 = ";
(++p1).printpt(); //increases after use
cout << "\np2++ = ";
(p2++).printpt(); //uses after incrases
cout << "\n p2 = "; p2.printpt();
p3 = p1++; //assigns after increases
cout << "\n p3 = "; p3.printpt();
cout << "\n p1 = "; p1.printpt();
}