Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class Point {
- private:
- double x, y;
- public:
- Point(double xx, double yy) : x(xx), y(yy) {}
- const double getX() {
- return x;
- }
- const double getY() {
- return y;
- }
- friend ostream &operator<<(ostream &output, Point & p) {
- output << '(' << p.getX() << ',' << p.getY() << ')';
- return output;
- }
- };
- int main() {
- Point a(1, 2);
- Point * b = new Point(7, 9);
- cout << a << ' ' << *b << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement