CSC112 Spring 2016 Examples
// A little class that does some 2d Point arithmetic1#ifndef POINT_H2#define POINT_H34#include <iostream>56class Point {7public:8//overloaded constructors!9Point();10Point(double _x, double _y);1112//overloaded methods for accessing x and y13double x();14void x(double val);15double y();16void y(double val);1718//overloaded addition and subtraction operators19Point operator+(Point &rhs);20Point &operator+=(Point &rhs);21Point operator-(Point &rhs);22Point &operator-=(Point &rhs);2324private:25//private attributes of the class26double _x;27double _y;28};293031//insertion operator (NOTE: This is not a member.)32std::ostream& operator<<(std::ostream &os, Point &rhs);33#endif343536