C++??????????
???????????? ???????[ 2012/11/20 9:56:46 ] ????????
?????????????????Point??????????????????????x??y??????????????Point?????????Point?????x?????Point??x????y?????Point??y????
????????
#include<iostream>
#include<algorithm>
#include "Point.h"
using namespace std;
int main()
{
Point pt1(3??4);
Point pt2(4??5);
Point pt3=pt1+pt2;
cout<<pt3.getX()<<endl<<pt3.getY()<<endl;
return 0;
}
??????????????????????????????????????????????????????????????????汻?????????????????????????????
????2???????????
???????????ж?????????????
bool operator==(const Point&);
bool operator!=(const Point&);
????????????????????????
bool Point::operator==(const Point &pt)
{
return this->x==pt.x&&this->y==pt.y;
}
bool Point::operator!=(const Point &pt)
{
return !(*this==pt);
}
?????????漲????==?????????????????!=?????????????==????????????????????????????????????==?????棬??!=??????
????3???????????????????????
????????????????????????????????????????????????????????????????????????????????????
???????????ж??庯????
Point& operator++();
Point& operator--();
???????????????????
Point& Point::operator ++()
{
this->x++;
this->y++;
return *this;
}
Point& Point::operator --()
{
x--;
y--;
return *this;
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11