uniary overloading

 #include <iostream>

using namespace std;

class Point
{
int x, y;
public:
Point()
{
x = 5;
y = 7;
}
void operator ++(int)
{
x++;
y++;
}

void showPoint()
{
cout<<"Point - x: "<<x<<" y: "<<y<<endl;
}
};

int main()
{
Point p1;
p1++;
p1.showPoint();
return 0;

}

Comments

Popular posts from this blog

Use of function in mathematics

My resume using HTML and CSS