| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #include "point.h"
- Point::Point( int px, int py )
- : x( px ),
- y( py )
- {
- }
- Point::Point( const Point& other )
- : x( other.x ),
- y( other.y )
- {
- }
- void Point::Offset( int xOffset, int yOffset )
- {
- x += xOffset;
- y += yOffset;
- }
- void Point::Offset( const Point& point )
- {
- x += point.x;
- y += point.y;
- }
- Point& Point::operator += ( const Point& other )
- {
- x += other.x;
- y += other.y;
-
- return *this;
- }
- Point& Point::operator -= ( const Point& other )
- {
- x -= other.x;
- y -= other.y;
-
- return *this;
- }
- Point operator + ( const Point& p1, const Point& p2 )
- {
- return Point( p1.x + p2.x, p1.y + p2.y );
- }
- Point operator - ( const Point& p1, const Point& p2 )
- {
- return Point( p1.x - p2.x, p1.y - p2.y );
- }
- bool operator == ( const Point& p1, const Point& p2 )
- {
- return ( ( p1.x == p2.x ) && ( p1.y == p2.y ) );
- }
|