Skip to content

Instantly share code, notes, and snippets.

@drewlesueur
Created November 7, 2011 04:38
Show Gist options
  • Save drewlesueur/1344189 to your computer and use it in GitHub Desktop.
Save drewlesueur/1344189 to your computer and use it in GitHub Desktop.
dart
class Point {
Point(this.x, this.y);
distanceTo(Point other) {
var dx = x - other.x;
var dy = y - other.y;
return Math.sqrt(dx * dx + dy * dy);
}
var x, y;
}
main() {
Point p = new Point(2, 3);
Point q = new Point(3, 4);
var d = p.distanceTo;
print(d(new Point(5,5)));
print('distance from p to q = ${p.distanceTo(q)}');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment