Skip to content

Instantly share code, notes, and snippets.

@heronyang
Last active August 3, 2019 20:38
Show Gist options
  • Save heronyang/5bb91ad5c3d78709ebed648afeb14419 to your computer and use it in GitHub Desktop.
Save heronyang/5bb91ad5c3d78709ebed648afeb14419 to your computer and use it in GitHub Desktop.
/* point.cc */
#include "point.h"
#include <math.h>
Point::Point(double x, double y): x(x), y(y) {}
double Point::getDistance(const Point& p) const {
double dx = x - p.x;
double dy = y - p.y;
return sqrt(dx*dx + dy*dy);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment