#include<iostream>
#include<cstdlib>
#include<iomanip>
#include<string>
class point
{
private:
int x,y;
public:
point();
point operator+(point);
point operator+(int);
point operator++();
void getxy();
void setxy(int,int);
};
point::point()
{
x=0;
y=0;
}
point point::operator+(point obj)
{
point t;
t.x=x+obj.x;
t.y=y+obj.y;
point point::operator+(int n)
{
point t;
t.x=x+n;
t.y=y+n;
point point::operator++()
{
x=x+1;
y=y+1;
void point::getxy()
{
cout<<"x座標:"<<x<<"\t y座標:"<<y<<endl;
}
void point::setxy(int x1,int y1)
{
x=x1;
y=y1;
}
int main()
{
point p1,p2,p3;
p1.setxy(10,20);
cout<<"obj1座標->";
p1.getxy();
p2.setxy(15,23);
cout<<"obj2座標->";
p2.getxy();
p3.setxy(0,0);
cout<<"obj3座標->";
p3.getxy();
p3=p1+p2;
cout<<"p1+p2=p3 \n p3座標->";
p3.getxy();
p3=p3+6;
cout<<"p3+6 \n p3座標->";
p3.getxy();
++p3;
cout<<"++p3 \n p3座標->";
p3.getxy();
system("PAUSE");
return 0;
}