------------------------------------------------------------------------------
MC logo
Point Class Implementation File III
[^] Code Examples
------------------------------------------------------------------------------
<<Point Class Header File III point5.cc Point Class User File III>>
#include "point5.h"
#include <iostream>
#include <math.h>

using namespace std;

// Distance to another point.  Pythagorean thm.
double Point::dist(Point other) {
        double xd = xval - other.xval;
        double yd = yval - other.yval;
        return sqrt(xd*xd + yd*yd);
}

// Print points using the << operator, so they can be printed along with
// other data types.
ostream & operator<<(ostream &strm, Point p)
{
        p.print(strm);
        return strm;
}
<<Point Class Header File III Point Class User File III>>