class Pointgtypes.h interface instead.
| Constructor | |
| Point() Point(x, y) | Creates a Point object with the specified x and y coordinates. |
| Methods | |
| getX() | Returns the x-coordinate of the point. |
| getY() | Returns the y-coordinate of the point. |
| toString() | Returns a string representation of the Point in the form "(x, y)". |
| Operators | |
| if (p1 == p2) . . . | Returns true if p1 and p2 are the same point. |
| if (p1 != p2) . . . | Returns true if p1 and p2 are different |
| cout << pt; | Overloads the << operator so that it is able to display Point values. |
Point(); Point(int x, int y);
Point object with the specified x and y coordinates.
If the coordinates are not supplied, the default constructor sets these
fields to 0.
Usage:
Point origin; Point pt(x, y);
int getX();
Usage:
int x = pt.getX();
int getY();
Usage:
int y = pt.getY();
string toString();
Point in the form
"(x, y)".
Usage:
string str = pt.toString();
bool operator==(Point p2);
true if p1 and p2
are the same point.
Usage:
if (p1 == p2) . . .
bool operator!=(Point p2);
true if p1 and p2
are different
Usage:
if (p1 != p2) . . .
ostream & operator<<(ostream & os, Point pt);
<< operator so that it is able
to display Point values.
Usage:
cout << pt;